diff options
author | yfszzx <yfszzx@gmail.com> | 2022-10-14 03:51:26 +0000 |
---|---|---|
committer | yfszzx <yfszzx@gmail.com> | 2022-10-14 03:51:26 +0000 |
commit | d48f3470c8a86f22dce106e7d3c1803e5ba92085 (patch) | |
tree | 2526ceaffa0177b40cecc30854f66a524cf6ac71 /modules/interrogate.py | |
parent | 4a37c7eedeab579efec03e8dae3f3f9fd4a37b02 (diff) | |
parent | 7c8903367c350e7e3ba8f90679890566446f36b2 (diff) | |
download | stable-diffusion-webui-gfx803-d48f3470c8a86f22dce106e7d3c1803e5ba92085.tar.gz stable-diffusion-webui-gfx803-d48f3470c8a86f22dce106e7d3c1803e5ba92085.tar.bz2 stable-diffusion-webui-gfx803-d48f3470c8a86f22dce106e7d3c1803e5ba92085.zip |
Merge branch 'master' of https://github.com/yfszzx/stable-diffusion-webui-plus
Diffstat (limited to 'modules/interrogate.py')
-rw-r--r-- | modules/interrogate.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/interrogate.py b/modules/interrogate.py index 635e266e..af858cc0 100644 --- a/modules/interrogate.py +++ b/modules/interrogate.py @@ -123,7 +123,7 @@ class InterrogateModels: return caption[0]
- def interrogate(self, pil_image):
+ def interrogate(self, pil_image, include_ranks=False):
res = None
try:
@@ -156,7 +156,10 @@ class InterrogateModels: for name, topn, items in self.categories:
matches = self.rank(image_features, items, top_count=topn)
for match, score in matches:
- res += ", " + match
+ if include_ranks:
+ res += ", " + match
+ else:
+ res += f", ({match}:{score})"
except Exception:
print(f"Error interrogating", file=sys.stderr)
|