Update app.py
Browse files
app.py
CHANGED
@@ -23,12 +23,21 @@ def classify_image(img):
|
|
23 |
confidence = np.max(predictions)
|
24 |
return {class_labels[i]: float(predictions[0][i]) for i in range(len(class_labels))}, confidence
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
# Gradio interface
|
27 |
demo = gr.Interface(
|
28 |
fn=classify_image,
|
29 |
inputs=gr.Image(type="pil"),
|
30 |
outputs=[gr.Label(num_top_classes=len(class_labels)), gr.Number()],
|
31 |
-
live=True
|
|
|
32 |
)
|
33 |
|
34 |
if __name__ == "__main__":
|
|
|
23 |
confidence = np.max(predictions)
|
24 |
return {class_labels[i]: float(predictions[0][i]) for i in range(len(class_labels))}, confidence
|
25 |
|
26 |
+
# Example images (local paths or URLs)
|
27 |
+
example_images = [
|
28 |
+
'examples/fresh.jpg', # Replace with actual local file paths or URLs
|
29 |
+
'examples/early_decay.jpg',
|
30 |
+
'examples/advanced_decay.jpg',
|
31 |
+
'examples/skeletonized.jpg'
|
32 |
+
]
|
33 |
+
|
34 |
# Gradio interface
|
35 |
demo = gr.Interface(
|
36 |
fn=classify_image,
|
37 |
inputs=gr.Image(type="pil"),
|
38 |
outputs=[gr.Label(num_top_classes=len(class_labels)), gr.Number()],
|
39 |
+
live=True,
|
40 |
+
examples=example_images
|
41 |
)
|
42 |
|
43 |
if __name__ == "__main__":
|