Spaces:
Runtime error
Runtime error
kurianbenoy
commited on
Commit
•
a83c171
1
Parent(s):
dea9c3e
Update app.py
Browse files
app.py
CHANGED
@@ -63,7 +63,7 @@ def create_image(filename):
|
|
63 |
def predict(img):
|
64 |
img = PILImage.create(img)
|
65 |
_pred, _pred_w_idx, probs = model.predict(img)
|
66 |
-
# gradio doesn't support tensors, so
|
67 |
labels_probs = {labels[i]: float(probs[i]) for i, _ in enumerate(labels)}
|
68 |
return labels_probs
|
69 |
|
@@ -83,6 +83,8 @@ demo = gradio.Interface(
|
|
83 |
launch_options = {
|
84 |
"enable_queue": True,
|
85 |
"share": False,
|
|
|
|
|
86 |
}
|
87 |
|
88 |
demo.launch(**launch_options)
|
|
|
63 |
def predict(img):
|
64 |
img = PILImage.create(img)
|
65 |
_pred, _pred_w_idx, probs = model.predict(img)
|
66 |
+
# gradio doesn't support tensors, so converting to float
|
67 |
labels_probs = {labels[i]: float(probs[i]) for i, _ in enumerate(labels)}
|
68 |
return labels_probs
|
69 |
|
|
|
83 |
launch_options = {
|
84 |
"enable_queue": True,
|
85 |
"share": False,
|
86 |
+
# thanks Alex for pointing this option to cache examples
|
87 |
+
"cache_example": True,
|
88 |
}
|
89 |
|
90 |
demo.launch(**launch_options)
|