Update app.py
Browse files
app.py
CHANGED
|
@@ -7,9 +7,6 @@ import requests
|
|
| 7 |
import io
|
| 8 |
import numpy as np
|
| 9 |
|
| 10 |
-
# ------------------------
|
| 11 |
-
# 1. Plant Disease Detection Model
|
| 12 |
-
# ------------------------
|
| 13 |
processor = AutoImageProcessor.from_pretrained(
|
| 14 |
"linkanjarad/mobilenet_v2_1.0_224-plant-disease-identification"
|
| 15 |
)
|
|
@@ -29,9 +26,7 @@ def predict_disease(img):
|
|
| 29 |
confidence = torch.softmax(logits, dim=1)[0, pred_idx].item()
|
| 30 |
return f"Disease: {label}\nConfidence: {confidence:.2f}"
|
| 31 |
|
| 32 |
-
|
| 33 |
-
# 2. Hugging Face Chatbot / Voice Assistant
|
| 34 |
-
# ------------------------
|
| 35 |
def respond(
|
| 36 |
message,
|
| 37 |
history: list[dict[str, str]],
|
|
@@ -73,9 +68,7 @@ chatbot = gr.ChatInterface(
|
|
| 73 |
],
|
| 74 |
)
|
| 75 |
|
| 76 |
-
|
| 77 |
-
# 3. RootNet Gradio App Layout
|
| 78 |
-
# ------------------------
|
| 79 |
with gr.Blocks() as demo:
|
| 80 |
with gr.Sidebar():
|
| 81 |
gr.Markdown("# RootNet AI Dashboard")
|
|
|
|
| 7 |
import io
|
| 8 |
import numpy as np
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
processor = AutoImageProcessor.from_pretrained(
|
| 11 |
"linkanjarad/mobilenet_v2_1.0_224-plant-disease-identification"
|
| 12 |
)
|
|
|
|
| 26 |
confidence = torch.softmax(logits, dim=1)[0, pred_idx].item()
|
| 27 |
return f"Disease: {label}\nConfidence: {confidence:.2f}"
|
| 28 |
|
| 29 |
+
|
|
|
|
|
|
|
| 30 |
def respond(
|
| 31 |
message,
|
| 32 |
history: list[dict[str, str]],
|
|
|
|
| 68 |
],
|
| 69 |
)
|
| 70 |
|
| 71 |
+
|
|
|
|
|
|
|
| 72 |
with gr.Blocks() as demo:
|
| 73 |
with gr.Sidebar():
|
| 74 |
gr.Markdown("# RootNet AI Dashboard")
|