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

@@ -38,6 +38,14 @@ class MockServicesController < ApplicationController
render json: @data
end
def autotagger_evaluate
limit = params.fetch(:limit, 50)
predictions = tags(limit).pluck(:name).map { |name| [name, rand(0.0..1.0)] }.to_h
data = { filename: "test.jpg", tags: predictions }
render json: data
end
private
def posts(limit = 10)