Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,8 @@ import torch
|
|
| 2 |
from torchvision import transforms
|
| 3 |
from PIL import Image
|
| 4 |
from torchvision import models
|
|
|
|
|
|
|
| 5 |
import gradio as gr
|
| 6 |
|
| 7 |
# Define the ResNet50 model
|
|
@@ -45,7 +47,7 @@ def predict_image_label(image):
|
|
| 45 |
return label
|
| 46 |
|
| 47 |
# Create Gradio interface
|
| 48 |
-
image =
|
| 49 |
-
label =
|
| 50 |
|
| 51 |
gr.Interface(fn=predict_image_label, inputs=image, outputs=label, title="Leaf or Plant Classifier").launch()
|
|
|
|
| 2 |
from torchvision import transforms
|
| 3 |
from PIL import Image
|
| 4 |
from torchvision import models
|
| 5 |
+
import gradio.inputs as gi
|
| 6 |
+
import gradio.outputs as go
|
| 7 |
import gradio as gr
|
| 8 |
|
| 9 |
# Define the ResNet50 model
|
|
|
|
| 47 |
return label
|
| 48 |
|
| 49 |
# Create Gradio interface
|
| 50 |
+
image = gi.Image(shape=(224, 224))
|
| 51 |
+
label = go.Label(num_top_classes=2)
|
| 52 |
|
| 53 |
gr.Interface(fn=predict_image_label, inputs=image, outputs=label, title="Leaf or Plant Classifier").launch()
|