KhadijaAsehnoune12
commited on
Commit
•
e6de937
1
Parent(s):
bffe186
Update app.py
Browse files
app.py
CHANGED
@@ -1,33 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
-
from
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
if not isinstance(image, Image.Image):
|
13 |
-
return {"error": "Input is not a valid image"}
|
14 |
-
|
15 |
-
# Perform your prediction here
|
16 |
-
# Placeholder for actual prediction logic
|
17 |
-
result = {"Disease": "Predicted Disease", "Confidence": 0.95}
|
18 |
-
return result
|
19 |
-
|
20 |
-
except Exception as e:
|
21 |
-
return {"error": str(e)}
|
22 |
-
|
23 |
-
interface = gr.Interface(
|
24 |
-
fn=predict,
|
25 |
-
inputs=gr.Image(type="numpy"), # Use 'numpy' type for better compatibility
|
26 |
-
outputs=gr.Label(num_top_classes=3),
|
27 |
-
examples=[["MoucheB.jpg"], ["verdissement.jpg"]],
|
28 |
-
title="Orange Disease Detector",
|
29 |
-
description="Detect diseases in orange leaves and fruits."
|
30 |
-
)
|
31 |
-
|
32 |
-
if __name__ == "__main__":
|
33 |
-
interface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
pipe = pipeline(task="image-classification",
|
5 |
+
# model that can do 22k-category classification
|
6 |
+
model="KhadijaAsehnoune12/orange-disease-detector")
|
7 |
+
gr.Interface.from_pipeline(pipe,
|
8 |
+
title="22k Image Classification",
|
9 |
+
description="Detect diseases in orange leaves and fruits.",
|
10 |
+
examples = ['MoucheB.jpg', 'verdissement.jpg',],
|
11 |
+
).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|