aboutsummaryrefslogtreecommitdiffstats
path: root/modules/interrogate.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2022-10-13 05:05:41 +0000
committerGitHub <noreply@github.com>2022-10-13 05:05:41 +0000
commit4f73e057a9cb0caaa2adbd7d17ebf221f05821b0 (patch)
treea41ad3fb87cf47857f662f10ff898e87c128fab2 /modules/interrogate.py
parent490494320ec8b5e1049c4ff35c3416258b75807b (diff)
parent514456101b142b47acf87f6de95bad1a23d73be7 (diff)
downloadstable-diffusion-webui-gfx803-4f73e057a9cb0caaa2adbd7d17ebf221f05821b0.tar.gz
stable-diffusion-webui-gfx803-4f73e057a9cb0caaa2adbd7d17ebf221f05821b0.tar.bz2
stable-diffusion-webui-gfx803-4f73e057a9cb0caaa2adbd7d17ebf221f05821b0.zip
Merge pull request #2324 from HunterVacui/interrogate_include_ranks_in_output
Interrogate: add option to include ranks in output
Diffstat (limited to 'modules/interrogate.py')
-rw-r--r--modules/interrogate.py7
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)