yolac commited on
Commit
b1cfa7b
·
verified ·
1 Parent(s): faa394e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -33,7 +33,7 @@ class BacterialMorphologyClassifier(nn.Module):
33
  return x
34
 
35
  # Load the model
36
- MODEL_PATH = "https://huggingface.co/yolac/BacterialMorphologyClassification/resolve/main/model.pth"
37
  model = BacterialMorphologyClassifier()
38
 
39
  try:
@@ -78,6 +78,13 @@ def predict(image):
78
  except Exception as e:
79
  return f"Error: {str(e)}"
80
 
 
 
 
 
 
 
 
81
  # Set up Gradio interface
82
  interface = gr.Interface(
83
  fn=predict,
@@ -85,6 +92,7 @@ interface = gr.Interface(
85
  outputs=gr.Text(label="Prediction"),
86
  title="Bacterial Morphology Classification",
87
  description="Upload an image of bacteria to classify it as cocci, bacilli, or spirilla.",
 
88
  )
89
 
90
  # Launch the app
 
33
  return x
34
 
35
  # Load the model
36
+ MODEL_PATH = "model.pth"
37
  model = BacterialMorphologyClassifier()
38
 
39
  try:
 
78
  except Exception as e:
79
  return f"Error: {str(e)}"
80
 
81
+ # Define example images
82
+ examples = [
83
+ ["https://huggingface.co/datasets/yolac/BacterialMorphologyClassification/resolve/main/img%20290.jpg"],
84
+ ["https://huggingface.co/datasets/yolac/BacterialMorphologyClassification/resolve/main/img%20565.jpg"],
85
+ ["https://huggingface.co/datasets/yolac/BacterialMorphologyClassification/resolve/main/img%208.jpg"],
86
+ ]
87
+
88
  # Set up Gradio interface
89
  interface = gr.Interface(
90
  fn=predict,
 
92
  outputs=gr.Text(label="Prediction"),
93
  title="Bacterial Morphology Classification",
94
  description="Upload an image of bacteria to classify it as cocci, bacilli, or spirilla.",
95
+ examples=examples,
96
  )
97
 
98
  # Launch the app