Update app.py
Browse files
app.py
CHANGED
|
@@ -15,18 +15,24 @@ def predict(img):
|
|
| 15 |
pred, pred_idx, probs = learn.predict(img)
|
| 16 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 17 |
|
| 18 |
-
#Example images for demonstration
|
| 19 |
-
examples = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
# Create the Gradio interface
|
| 22 |
interface = gr.Interface(
|
| 23 |
fn=predict,
|
| 24 |
inputs=gr.Image(),
|
| 25 |
-
outputs=gr.Label(
|
|
|
|
| 26 |
)
|
| 27 |
|
| 28 |
# Enable the queue to handle POST requests
|
| 29 |
interface.queue(api_open=True)
|
| 30 |
|
| 31 |
# Launch the interface
|
| 32 |
-
interface.launch()
|
|
|
|
| 15 |
pred, pred_idx, probs = learn.predict(img)
|
| 16 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 17 |
|
| 18 |
+
# Example images for demonstration
|
| 19 |
+
examples = [
|
| 20 |
+
"Image1.jpg",
|
| 21 |
+
"Image3.jpg",
|
| 22 |
+
"Image5.jpg",
|
| 23 |
+
"Image5.webp"
|
| 24 |
+
]
|
| 25 |
|
| 26 |
# Create the Gradio interface
|
| 27 |
interface = gr.Interface(
|
| 28 |
fn=predict,
|
| 29 |
inputs=gr.Image(),
|
| 30 |
+
outputs=gr.Label(num_top_classes=3),
|
| 31 |
+
examples=examples # Move examples here
|
| 32 |
)
|
| 33 |
|
| 34 |
# Enable the queue to handle POST requests
|
| 35 |
interface.queue(api_open=True)
|
| 36 |
|
| 37 |
# Launch the interface
|
| 38 |
+
interface.launch()
|