223111524 commited on
Commit
4cd47e5
·
1 Parent(s): a929a06

Add error handling

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -1,9 +1,14 @@
1
  import gradio as gr
2
 
3
  def process_video(video, visualize_features):
4
- # Placeholder: In a real app, process the video and visualize features if requested
5
- msg = "Feature visualization enabled." if visualize_features else "Feature visualization disabled."
6
- return video, msg
 
 
 
 
 
7
 
8
  with gr.Blocks(theme=gr.themes.Base(), css=".gradio-container {background: #111827; color: #d1d5db;}") as demo:
9
  gr.Markdown(
 
1
  import gradio as gr
2
 
3
  def process_video(video, visualize_features):
4
+ if video is None:
5
+ return None, "Error: No video uploaded."
6
+ try:
7
+ # Placeholder: In a real app, process the video and visualize features if requested
8
+ msg = "Feature visualization enabled." if visualize_features else "Feature visualization disabled."
9
+ return video, msg
10
+ except Exception as e:
11
+ return None, f"Error: {str(e)}"
12
 
13
  with gr.Blocks(theme=gr.themes.Base(), css=".gradio-container {background: #111827; color: #d1d5db;}") as demo:
14
  gr.Markdown(