wxcyn commited on
Commit
fbd7cf2
·
verified ·
1 Parent(s): 6fcb6f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -167,18 +167,20 @@ def process_video(video_file, question, password, progress=gr.Progress()):
167
  else:
168
  raise gr.Error("Video clip file not found.")
169
 
170
- # If it returns a dict with "name"
171
- elif isinstance(video_clip_info, dict) and "name" in video_clip_info:
172
- clip_path = video_clip_info["name"]
173
- if os.path.exists(clip_path):
174
- return analysis_text, clip_path
 
 
 
 
175
  else:
176
- raise gr.Error("Video clip file not found.")
177
  else:
178
- # Unexpected format for video_clip_info
179
  raise gr.Error("Unexpected video clip info format.")
180
  else:
181
- # Unexpected result format
182
  raise gr.Error("Unexpected response format from private service.")
183
 
184
  def create_interface():
 
167
  else:
168
  raise gr.Error("Video clip file not found.")
169
 
170
+ # If it returns a dict, handle accordingly
171
+ elif isinstance(video_clip_info, dict):
172
+ # Check if "video" key is present
173
+ if "video" in video_clip_info:
174
+ clip_path = video_clip_info["video"]
175
+ if os.path.exists(clip_path):
176
+ return analysis_text, clip_path
177
+ else:
178
+ raise gr.Error("Video clip file not found.")
179
  else:
180
+ raise gr.Error("Unexpected dictionary format for video clip info.")
181
  else:
 
182
  raise gr.Error("Unexpected video clip info format.")
183
  else:
 
184
  raise gr.Error("Unexpected response format from private service.")
185
 
186
  def create_interface():