Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,7 +25,7 @@ model = create_mock_model()
|
|
| 25 |
|
| 26 |
# Function to preprocess the image and make predictions
|
| 27 |
def predict_image(image):
|
| 28 |
-
# Resize
|
| 29 |
img = cv2.resize(image, (224, 224))
|
| 30 |
img = img / 255.0 # Normalize to [0, 1] range
|
| 31 |
|
|
@@ -36,8 +36,8 @@ def predict_image(image):
|
|
| 36 |
label = train_info[top_class] # Get the corresponding label
|
| 37 |
return label
|
| 38 |
|
| 39 |
-
#
|
| 40 |
-
input_image = gr.Image(shape
|
| 41 |
output_label = gr.Label()
|
| 42 |
|
| 43 |
# Launch the Gradio interface
|
|
|
|
| 25 |
|
| 26 |
# Function to preprocess the image and make predictions
|
| 27 |
def predict_image(image):
|
| 28 |
+
# Resize and normalize the image
|
| 29 |
img = cv2.resize(image, (224, 224))
|
| 30 |
img = img / 255.0 # Normalize to [0, 1] range
|
| 31 |
|
|
|
|
| 36 |
label = train_info[top_class] # Get the corresponding label
|
| 37 |
return label
|
| 38 |
|
| 39 |
+
# Define the Gradio interface without the 'shape' argument
|
| 40 |
+
input_image = gr.Image() # Removed 'shape' argument
|
| 41 |
output_label = gr.Label()
|
| 42 |
|
| 43 |
# Launch the Gradio interface
|