Spaces:
Runtime error
Runtime error
luanvenanciosoitic
commited on
Commit
·
e6ee6a8
1
Parent(s):
a95006c
initial commit
Browse files- app.py +20 -0
- requirements.txt +4 -0
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
from PIL import Image
|
| 4 |
+
|
| 5 |
+
# Load the image classification pipeline with your model
|
| 6 |
+
pipe = pipeline("image-classification", model="surgeonwz/plant-village")
|
| 7 |
+
|
| 8 |
+
def predict(image):
|
| 9 |
+
predictions = pipe(image)
|
| 10 |
+
return {p['label']: p['score'] for p in predictions}
|
| 11 |
+
|
| 12 |
+
iface = gr.Interface(
|
| 13 |
+
fn=predict,
|
| 14 |
+
inputs=gr.Image(type="pil", label="Upload Plant Image"),
|
| 15 |
+
outputs=gr.Label(num_top_classes=3, label="Analysis Results"),
|
| 16 |
+
title="Plant Disease Detector",
|
| 17 |
+
description="Upload an image of a plant leaf to classify its health."
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
iface.launch(share=True)
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
transformers
|
| 3 |
+
torch
|
| 4 |
+
Pillow
|