Spaces:
Sleeping
Sleeping
Brice Vandeputte
commited on
Commit
•
988fe51
1
Parent(s):
07775e1
logger test2
Browse files
app.py
CHANGED
@@ -179,11 +179,14 @@ def api_classification(img, rank: int): # -> dict[str, float]:
|
|
179 |
for i in torch.nonzero(probs > min_prob).squeeze():
|
180 |
output[" ".join(txt_names[i][0][: rank + 1])] += probs[i]
|
181 |
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
|
|
|
|
|
|
187 |
|
188 |
|
189 |
def change_output(choice):
|
|
|
179 |
for i in torch.nonzero(probs > min_prob).squeeze():
|
180 |
output[" ".join(txt_names[i][0][: rank + 1])] += probs[i]
|
181 |
|
182 |
+
topk_names = heapq.nlargest(k, output, key=output.get)
|
183 |
+
|
184 |
+
exampleB = topk_names[0]
|
185 |
+
logger.info("exampleB")
|
186 |
+
logger.info(exampleB)
|
187 |
+
logger.info("output(exampleB)")
|
188 |
+
logger.info(output(exampleB))
|
189 |
+
return {name: output[name] for name in topk_names}
|
190 |
|
191 |
|
192 |
def change_output(choice):
|