diff options
author | 不会画画的中医不是好程序员 <yfszzx@gmail.com> | 2022-10-13 23:35:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-13 23:35:07 +0000 |
commit | 7c8903367c350e7e3ba8f90679890566446f36b2 (patch) | |
tree | a949c12c2a93c4e20aff30adf4412a450f6b2b8e /modules/interrogate.py | |
parent | a1489f94283c07824a7a58353c03dc89541bbe49 (diff) | |
parent | 08b3f7aef15f74f4d2254b1274dd66fcc7940348 (diff) | |
download | stable-diffusion-webui-gfx803-7c8903367c350e7e3ba8f90679890566446f36b2.tar.gz stable-diffusion-webui-gfx803-7c8903367c350e7e3ba8f90679890566446f36b2.tar.bz2 stable-diffusion-webui-gfx803-7c8903367c350e7e3ba8f90679890566446f36b2.zip |
Merge branch 'AUTOMATIC1111:master' into master
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)
|