hb-setosys commited on
Commit
c1a4833
·
verified ·
1 Parent(s): f6ff59d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -31,14 +31,14 @@ def predict_image(image):
31
  except Exception as e:
32
  return [("Error", str(e))]
33
 
34
- # Create the Gradio interface
35
  interface = gr.Interface(
36
  fn=predict_image,
37
  inputs=gr.Image(type="pil"), # Accepts an image input
38
- outputs=gr.Label(num_top_classes=2), # Shows top 5 predictions with confidence
39
  title="Image Classifier",
40
  description="Upload an image, and the model will predict what's in the image with higher accuracy.",
41
-
42
  )
43
 
44
  # Launch the Gradio app
 
31
  except Exception as e:
32
  return [("Error", str(e))]
33
 
34
+ # Create the Gradio interface with gr.Dataframe for displaying predictions
35
  interface = gr.Interface(
36
  fn=predict_image,
37
  inputs=gr.Image(type="pil"), # Accepts an image input
38
+ outputs=gr.Dataframe(headers=["Label", "Confidence"], type="array"), # Shows top 5 predictions as a table
39
  title="Image Classifier",
40
  description="Upload an image, and the model will predict what's in the image with higher accuracy.",
41
+ examples=["dog.jpg", "cat.jpg", "building.jpg", "tree.jpg"], # Example images for testing
42
  )
43
 
44
  # Launch the Gradio app