ai tags: add autotagger API client.

Add API client for https://github.com/danbooru/autotagger service.
This commit is contained in:
evazion
2022-06-27 01:09:14 -05:00
parent c199c7eab7
commit ee57ada33b
4 changed files with 44 additions and 0 deletions

View File

@@ -542,6 +542,16 @@ module Danbooru
# "http://localhost:3000/mock/iqdb"
end
# The URL for the Danbooru Autotagger service (https://github.com/danbooru/autotagger). Optional.
#
# Used for the AI tagging feature. Set this to http://localhost:3000/mock/autotagger
# to enable a fake server for development purposes, or do
# `docker run --rm -p 5000:5000 ghcr.io/danbooru/autotagger` to run a real server.
def autotagger_url
# "http://localhost:3000/mock/autotagger"
# "http://localhost:5000"
end
def aws_credentials
Aws::Credentials.new(Danbooru.config.aws_access_key_id, Danbooru.config.aws_secret_access_key)
end

View File

@@ -365,6 +365,7 @@ Rails.application.routes.draw do
get "/mock/reportbooru/post_views/rank" => "mock_services#reportbooru_post_views", as: "mock_reportbooru_post_views"
get "/mock/iqdb/query" => "mock_services#iqdb_query", as: "mock_iqdb_query"
post "/mock/iqdb/query" => "mock_services#iqdb_query"
get "/mock/autotagger/evaluate" => "mock_services#autotagger_evaluate", as: "mock_autotagger_evaluate"
match "*other", to: "static#not_found", via: :all
end