KhodemPlus's picture
Create app.py
eedbb76 verified
raw
history blame contribute delete
No virus
900 Bytes
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()