yolac commited on
Commit
21e99b3
·
verified ·
1 Parent(s): 1b9be77

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -68,13 +68,21 @@ def predict(image):
68
  except Exception as e:
69
  return {'error': str(e)}
70
 
71
- # Set up Gradio interface
 
 
 
 
 
 
 
72
  iface = gr.Interface(
73
  fn=predict,
74
  inputs=gr.inputs.Image(type="pil", label="Upload an image"),
75
  outputs=gr.outputs.Label(num_top_classes=3, label="Predicted class and confidence"),
76
  title="Bacterial Morphology Classifier",
77
- description="Upload an image of a bacterial sample to classify it as 'cocci', 'bacilli', or 'spirilla'."
 
78
  )
79
 
80
  # Launch the app
 
68
  except Exception as e:
69
  return {'error': str(e)}
70
 
71
+ # Example input images (provide paths or URLs)
72
+ example_images = [
73
+ "https://huggingface.co/datasets/yolac/BacterialMorphologyClassification/viewer?row=0&image-viewer=52B421CB70A43313B278D5DD2C58CECE56343012", # Replace with the actual paths to your example images
74
+ "https://huggingface.co/datasets/yolac/BacterialMorphologyClassification/viewer/default/train?p=2&row=201&image-viewer=558EA847F2267CECF4E2CFF6352F9D8888E9A72F",
75
+ "https://huggingface.co/datasets/yolac/BacterialMorphologyClassification/viewer/default/train?p=2&row=201&image-viewer=8FBAF2C52C256A392660811C5659788734821C3A"
76
+ ]
77
+
78
+ # Set up Gradio interface with examples
79
  iface = gr.Interface(
80
  fn=predict,
81
  inputs=gr.inputs.Image(type="pil", label="Upload an image"),
82
  outputs=gr.outputs.Label(num_top_classes=3, label="Predicted class and confidence"),
83
  title="Bacterial Morphology Classifier",
84
+ description="Upload an image of a bacterial sample to classify it as 'cocci', 'bacilli', or 'spirilla'.",
85
+ examples=example_images # Provide the example image paths
86
  )
87
 
88
  # Launch the app