John2J commited on
Commit
479fa4e
·
verified ·
1 Parent(s): 66d970f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -217,10 +217,6 @@ def process_video(
217
  import torch
218
  import decord
219
 
220
- # --------------------------------------------------------
221
- # Validate inputs
222
- # --------------------------------------------------------
223
-
224
  if video_path is None:
225
  raise gr.Error(
226
  "Please upload an input video."
@@ -231,6 +227,24 @@ def process_video(
231
  "Please upload a mask video."
232
  )
233
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  if not prompt or not prompt.strip():
235
  raise gr.Error(
236
  "Please enter a prompt describing the video scene."
@@ -765,13 +779,11 @@ content consistent with the surrounding scene.
765
  input_video = gr.Video(
766
  label="Input Video",
767
  sources=["upload"],
768
- type="filepath",
769
  )
770
 
771
  input_mask = gr.Video(
772
  label="Mask Video",
773
  sources=["upload"],
774
- type="filepath",
775
  )
776
 
777
  prompt = gr.Textbox(
 
217
  import torch
218
  import decord
219
 
 
 
 
 
220
  if video_path is None:
221
  raise gr.Error(
222
  "Please upload an input video."
 
227
  "Please upload a mask video."
228
  )
229
 
230
+ # Current Gradio normally returns a filepath,
231
+ # but support dictionary results as well.
232
+ if isinstance(video_path, dict):
233
+ video_path = video_path.get("path")
234
+
235
+ if isinstance(mask_path, dict):
236
+ mask_path = mask_path.get("path")
237
+
238
+ if not video_path:
239
+ raise gr.Error(
240
+ "Could not obtain the uploaded video filepath."
241
+ )
242
+
243
+ if not mask_path:
244
+ raise gr.Error(
245
+ "Could not obtain the uploaded mask filepath."
246
+ )
247
+
248
  if not prompt or not prompt.strip():
249
  raise gr.Error(
250
  "Please enter a prompt describing the video scene."
 
779
  input_video = gr.Video(
780
  label="Input Video",
781
  sources=["upload"],
 
782
  )
783
 
784
  input_mask = gr.Video(
785
  label="Mask Video",
786
  sources=["upload"],
 
787
  )
788
 
789
  prompt = gr.Textbox(