Spaces:
Running
Running
Update model output processing
Browse files
app.py
CHANGED
|
@@ -47,7 +47,7 @@ def vic(filename: str, alpha: Optional[float] = None):
|
|
| 47 |
images = processor(images=[Image.open(filename)], return_tensors="pt", padding=True)
|
| 48 |
outputs = model(images, alpha=alpha)
|
| 49 |
vocabulary = outputs["vocabularies"][0]
|
| 50 |
-
scores = outputs["scores"][0]
|
| 51 |
confidences = dict(zip(vocabulary, scores))
|
| 52 |
|
| 53 |
return confidences
|
|
|
|
| 47 |
images = processor(images=[Image.open(filename)], return_tensors="pt", padding=True)
|
| 48 |
outputs = model(images, alpha=alpha)
|
| 49 |
vocabulary = outputs["vocabularies"][0]
|
| 50 |
+
scores = outputs["scores"][0].tolist()
|
| 51 |
confidences = dict(zip(vocabulary, scores))
|
| 52 |
|
| 53 |
return confidences
|