File size: 900 Bytes
eedbb76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
31
import streamlit as st
from transformers import pipeline

# Load the Hugging Face model
model_name = "linkanjarad/mobilenet_v2_1.0_224-plant-disease-identification"
model = pipeline("image-classification", model=model_name)

# Streamlit app
st.title("Plant Disease Detection")
st.write("Upload an image of a plant leaf to detect the disease.")

# File uploader
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])

if uploaded_file is not None:
    # Display the uploaded image
    st.image(uploaded_file, caption="Uploaded Image", use_column_width=True)
    st.write("Classifying...")

    # Classify the image using the model
    results = model(uploaded_file)

    # Display the results
    st.write("Results:")
    for result in results:
        st.write(f"{result['label']}: {result['score']:.2f}")

# Run the Streamlit app
if __name__ == "__main__":
    st.run()