picobyte / stable-diffusion-webui-wd14-tagger

Labeling extension for Automatic1111's Web UI
580 stars 70 forks source link

"'WaifuDiffusionInterrogator' object has no attribute 'postprocess_tags'" #7

Closed Ezil15 closed 1 year ago

Ezil15 commented 1 year ago

If you try to make an API request, the following response occurs

{ "error": "AttributeError", "detail": "", "body": "", "errors": "'WaifuDiffusionInterrogator' object has no attribute 'postprocess_tags'" }

It seemsthat the Interrogate class has lost the necessary postprocess_tags method. If you copy it completely from the original repository, then everything starts working.

picobyte commented 1 year ago

The postprocessing of tags code is moved to the QData.apply_filters(), but I fear there are going to be more changes that just this. What is this external api, what is it used for and how is it used? It was not mentioned anywhere in the readme, so I only recently became aware there was something missing.

Raw query data is now stored/reloaded in/from a database db.json, and filters are applied on top of that. The apply_filters() occurs late and feeds the ui with the desired output. To facilitate an external query, I think we either should send this json and filter it on your end, or we could make a second json, after filtering to be received on request.

picobyte commented 1 year ago

I've applied a patch ad28db34e0ec9def28b673a0d339fdff09f34396 and another, is it fixed in the master branch? Also how exactly can I test this external api?

Also can you give some proper use case?

picobyte commented 1 year ago

I've closed this issue, in lack of response, the commit should have fixed it, but you can let me know if it did not.

Ezil15 commented 1 year ago

Thank you for the quick response to the problem and I apologize for the late response. I am testing the api through the functionality built into the WEB Ui. At the bottom of the page there is an "API" button that allows you to check how various endpoints APIs work.

picobyte commented 1 year ago

No problem, thanks for your reply, Edit: I've found it, thanks! now I can test it out. And to answer my own question: not functional right now.

picobyte commented 1 year ago

Reminder to self: The API link entirely on the bottom of the page, to the right.

The interrogators does function still, note that the interrogator names have changed. For me the response is

{
  "models": [
    "wd14-vit.v1",
    "wd14-vit.v2",
    "wd14-convnext.v1",
    "wd14-convnext.v2",
    "wd14-convnextv2.v1",
    "wd14-swinv2-v1",
    "mld-caformer.dec-5-97527",
    "mld-tresnetd.6-30000",
    "wd-v1-4-moat-tagger.v2",
    "deepdanbooru-v3-20211112-sgd-e28",
    "deepdanbooru-v4-20200814-sgd-e30",
    "wd-v1-4-convnextv2-tagger-v2",
    "Z3D-E621-Convnext"
  ]
}

but two were installed manually and may not appear in your list.

The interrogation does give a problem with an url or local file. The query:

{
  "image": "https://upload.wikimedia.org/wikipedia/commons/4/43/Minimalist_info_Icon.png",
  "model": "wd14-vit.v1",
  "threshold": 0.35
}

gives a response:

{
  "error": "HTTPException",
  "detail": "Invalid encoded image",
  "body": "",
  "errors": ""
}

but this error seems to come from the from modules.api.api import decode_base64_to_image and It seems this image should be a base64 encoded image entered as string, rather than a link or path.

try it out here, That works just fine.

So, an url does not work? Also the threshold, I don't believe this does anything, currently. I believe there could be some more options.