Linhh commited on
Commit
8784b0f
Β·
verified Β·
1 Parent(s): 7d144bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
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
- ).launch(share=True)
 
 
 
 
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