Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,10 +9,13 @@ def predict(img):
|
|
9 |
pred,pred_idx,probs = learn.predict(img)
|
10 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
11 |
|
12 |
-
gr.Interface(
|
13 |
fn=predict,
|
14 |
inputs=gr.Image(type="pil", image_mode="RGB", height=512, width=512, sources=["upload"]),
|
15 |
outputs=gr.Label(num_top_classes=3),
|
16 |
title="Image Classifier",
|
17 |
description="Upload an image; the app resizes to 512Γ512 inside predict()."
|
18 |
-
)
|
|
|
|
|
|
|
|
9 |
pred,pred_idx,probs = learn.predict(img)
|
10 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
11 |
|
12 |
+
demo = gr.Interface(
|
13 |
fn=predict,
|
14 |
inputs=gr.Image(type="pil", image_mode="RGB", height=512, width=512, sources=["upload"]),
|
15 |
outputs=gr.Label(num_top_classes=3),
|
16 |
title="Image Classifier",
|
17 |
description="Upload an image; the app resizes to 512Γ512 inside predict()."
|
18 |
+
)
|
19 |
+
|
20 |
+
if __name__ == "__main__":
|
21 |
+
demo.launch() # trΓͺn Spaces khΓ΄ng dΓΉng share=True
|