Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -60,6 +60,9 @@ preprocess = transforms.Compose([
|
|
60 |
|
61 |
# Function to perform predictions and show probabilities
|
62 |
def predict(image):
|
|
|
|
|
|
|
63 |
# Apply preprocessing to the input image
|
64 |
image = Image.fromarray(image).convert("RGB")
|
65 |
input_tensor = preprocess(image).unsqueeze(0).to(device)
|
@@ -84,4 +87,4 @@ def predict(image):
|
|
84 |
iface = gr.Interface(fn=predict, inputs=gr.Image(type="numpy"), outputs="text", live=True)
|
85 |
|
86 |
# Launch the interface
|
87 |
-
iface.launch()
|
|
|
60 |
|
61 |
# Function to perform predictions and show probabilities
|
62 |
def predict(image):
|
63 |
+
if image is None: # Check if no image was provided
|
64 |
+
return "Please insert photo"
|
65 |
+
|
66 |
# Apply preprocessing to the input image
|
67 |
image = Image.fromarray(image).convert("RGB")
|
68 |
input_tensor = preprocess(image).unsqueeze(0).to(device)
|
|
|
87 |
iface = gr.Interface(fn=predict, inputs=gr.Image(type="numpy"), outputs="text", live=True)
|
88 |
|
89 |
# Launch the interface
|
90 |
+
iface.launch()
|