Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,7 +14,8 @@ def predict(img):
|
|
| 14 |
# Fetch the labels dynamically from the model's vocabulary
|
| 15 |
labels = learn.dls.vocab
|
| 16 |
# Ensure probabilities are floats
|
| 17 |
-
return {labels[i]:
|
|
|
|
| 18 |
except Exception as e:
|
| 19 |
# Log the exception and return it as an error message
|
| 20 |
print(f"An error occurred: {e}")
|
|
|
|
| 14 |
# Fetch the labels dynamically from the model's vocabulary
|
| 15 |
labels = learn.dls.vocab
|
| 16 |
# Ensure probabilities are floats
|
| 17 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 18 |
+
|
| 19 |
except Exception as e:
|
| 20 |
# Log the exception and return it as an error message
|
| 21 |
print(f"An error occurred: {e}")
|