Spaces:
Sleeping
Sleeping
File size: 947 Bytes
fc7a35c bb124e4 fc7a35c bb124e4 fc7a35c bb124e4 fc7a35c bb124e4 fc7a35c bb124e4 fc7a35c bb124e4 fc7a35c bb124e4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import streamlit as st
import requests
import pandas as pd
from PIL import Image
import io
st.title("🌳 Tree Disease Diagnosis System")
uploaded_file = st.file_uploader("Upload an image of a tree leaf", type=["jpg", "jpeg", "png"])
if uploaded_file:
image = Image.open(uploaded_file)
st.image(image, caption="Uploaded Image", use_column_width=True)
with st.spinner("Diagnosing..."):
response = requests.post(
"http://localhost:8000/predict",
files={"file": uploaded_file.getvalue()}
)
result = response.json()
st.success(f"Prediction: **{result['prediction']}**")
st.write(f"Confidence: {result['confidence']:.2%}")
st.write(f"Suggested Treatment: {result['treatment']}")
st.write(f"Fertilizer Advice: {result['fertilizer']}")
st.write(f"AI Explanation: {result['explanation']}")
if result["alert"]:
st.error("⚠️ High-Risk Disease Detected!")
|