Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load the Hugging Face model
|
5 |
+
model = pipeline("image-classification", model="models/ombhojane/healthyPlantsModel")
|
6 |
+
|
7 |
+
# Create a Streamlit app
|
8 |
+
st.title("Plant Disease Detection")
|
9 |
+
|
10 |
+
# Add a file uploader to allow the user to upload an image
|
11 |
+
uploaded_file = st.file_uploader("Upload an image of your plant")
|
12 |
+
|
13 |
+
# If the user has uploaded an image, make a prediction
|
14 |
+
if uploaded_file is not None:
|
15 |
+
prediction = model(uploaded_file)
|
16 |
+
|
17 |
+
# Display the prediction
|
18 |
+
st.write("Prediction:")
|
19 |
+
st.text(prediction[0]["label"])
|
20 |
+
|
21 |
+
else:
|
22 |
+
st.write("Please upload an image of your plant")
|