Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,7 +28,7 @@ from html_templates import (
|
|
| 28 |
format_multiple_breeds_result,
|
| 29 |
format_unknown_breed_message,
|
| 30 |
format_not_dog_message,
|
| 31 |
-
|
| 32 |
format_multi_dog_container,
|
| 33 |
format_breed_details_html,
|
| 34 |
get_color_scheme,
|
|
@@ -357,7 +357,7 @@ def predict(image):
|
|
| 357 |
tuple: (html_output, annotated_image, initial_state)
|
| 358 |
"""
|
| 359 |
if image is None:
|
| 360 |
-
return
|
| 361 |
|
| 362 |
try:
|
| 363 |
if isinstance(image, np.ndarray):
|
|
@@ -463,7 +463,7 @@ def predict(image):
|
|
| 463 |
except Exception as e:
|
| 464 |
error_msg = f"An error occurred: {str(e)}\n\nTraceback:\n{traceback.format_exc()}"
|
| 465 |
print(error_msg)
|
| 466 |
-
return
|
| 467 |
|
| 468 |
|
| 469 |
def show_details_html(choice, previous_output, initial_state):
|
|
@@ -495,7 +495,7 @@ def show_details_html(choice, previous_output, initial_state):
|
|
| 495 |
except Exception as e:
|
| 496 |
error_msg = f"An error occurred while showing details: {e}"
|
| 497 |
print(error_msg)
|
| 498 |
-
return
|
| 499 |
|
| 500 |
def main():
|
| 501 |
with gr.Blocks(css=get_css_styles()) as iface:
|
|
|
|
| 28 |
format_multiple_breeds_result,
|
| 29 |
format_unknown_breed_message,
|
| 30 |
format_not_dog_message,
|
| 31 |
+
format_hint_html,
|
| 32 |
format_multi_dog_container,
|
| 33 |
format_breed_details_html,
|
| 34 |
get_color_scheme,
|
|
|
|
| 357 |
tuple: (html_output, annotated_image, initial_state)
|
| 358 |
"""
|
| 359 |
if image is None:
|
| 360 |
+
return format_hint_html("Please upload an image to start."), None, None
|
| 361 |
|
| 362 |
try:
|
| 363 |
if isinstance(image, np.ndarray):
|
|
|
|
| 463 |
except Exception as e:
|
| 464 |
error_msg = f"An error occurred: {str(e)}\n\nTraceback:\n{traceback.format_exc()}"
|
| 465 |
print(error_msg)
|
| 466 |
+
return format_hint_html(error_msg), None, None
|
| 467 |
|
| 468 |
|
| 469 |
def show_details_html(choice, previous_output, initial_state):
|
|
|
|
| 495 |
except Exception as e:
|
| 496 |
error_msg = f"An error occurred while showing details: {e}"
|
| 497 |
print(error_msg)
|
| 498 |
+
return format_hint_html(error_msg), gr.update(visible=True), initial_state
|
| 499 |
|
| 500 |
def main():
|
| 501 |
with gr.Blocks(css=get_css_styles()) as iface:
|