jschwab21 commited on
Commit
17c0909
·
verified ·
1 Parent(s): 23ff2b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -9
app.py CHANGED
@@ -131,15 +131,21 @@ def interface_function(video_file):
131
  def test_upload(uploaded_file):
132
  if uploaded_file is None:
133
  return "No file uploaded."
134
- # Assuming the file is saved in a temporary location and processed
135
- file_path = save_uploaded_file(uploaded_file) # Ensure this function saves and returns the path
136
- if not file_path:
137
- return "Failed to save file."
138
- # Process the video using the path
139
- result_path = process_video(file_path, description="Describe your clip here", is_url=False)
140
- if not result_path:
141
- return "Failed to process video or no scenes found."
142
- return f"Video processed and saved to: {result_path}"
 
 
 
 
 
 
143
 
144
  with gr.Blocks() as demo:
145
  with gr.Column():
 
131
  def test_upload(uploaded_file):
132
  if uploaded_file is None:
133
  return "No file uploaded."
134
+ try:
135
+ # Save the uploaded file and process it
136
+ file_path = save_uploaded_file(uploaded_file)
137
+ if not file_path:
138
+ return "Failed to save file."
139
+
140
+ # Process the video using the path
141
+ result_path = process_video(file_path, description="Describe your clip here", is_url=False)
142
+ if not result_path:
143
+ return "Failed to process video or no scenes found."
144
+
145
+ return f"Video processed and saved to: {result_path}"
146
+ except Exception as e:
147
+ # Catch any exceptions that occur and return them for debugging
148
+ return f"An error occurred: {str(e)}"
149
 
150
  with gr.Blocks() as demo:
151
  with gr.Column():