Spaces:
Runtime error
Runtime error
VenkataSaiNeha
commited on
Commit
•
e54fe7e
1
Parent(s):
cb09262
Delete app.py
Browse files
app.py
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
|
2 |
-
from gradio import Interface, Image, Label
|
3 |
-
import tensorflow as tf
|
4 |
-
# Load your TensorFlow model
|
5 |
-
model = tf.keras.models.load_model("mango-leaf-disease-detection.ipynb")
|
6 |
-
#Define your class names if needed
|
7 |
-
class_names = ['Anthracnose', 'Bacterial Canker', 'Cutting Weevil', 'Die Back', 'Gall Midge','Healthy','Powdery Mildew','Sooty Mould']
|
8 |
-
|
9 |
-
|
10 |
-
# Function to make predictions
|
11 |
-
def classify_image(image):
|
12 |
-
# Preprocess the image
|
13 |
-
img = tf.image.resize(image, (224, 224))
|
14 |
-
img = tf.expand_dims(img, 0) # Add batch dimension
|
15 |
-
# Make prediction
|
16 |
-
prediction = model.predict(img)
|
17 |
-
predicted_class = class_names[prediction.argmax()]
|
18 |
-
return predicted_class
|
19 |
-
|
20 |
-
# Gradio interface
|
21 |
-
image = Image() # Remove the `shape` argument
|
22 |
-
label = Label()
|
23 |
-
|
24 |
-
# Create interface
|
25 |
-
interface = Interface(classify_image, image, label,
|
26 |
-
title="MANGO_LEAF_DISEASE_DETECTION",
|
27 |
-
description="Upload an image of a leaf to detect its disease.").launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|