darshankr commited on
Commit
c2a0891
·
verified ·
1 Parent(s): 2142346

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -3,8 +3,6 @@ import os
3
  import subprocess
4
 
5
  # Define the paths where the input and output files will be stored
6
- INPUT_AUDIO_PATH = "input_audio.wav"
7
- INPUT_VIDEO_PATH = "input_video.mp4"
8
  OUTPUT_VIDEO_PATH = "output_video.mp4"
9
  MODEL_PATH = "checkpoints/checkpoint.pt"
10
 
@@ -23,11 +21,7 @@ def get_sample_flags(sample_mode):
23
  return None
24
 
25
  # Function to run the model inference command
26
- def generate_video(audio_file, video_file):
27
- # Save uploaded files to disk
28
- audio_file.save(INPUT_AUDIO_PATH)
29
- video_file.save(INPUT_VIDEO_PATH)
30
-
31
  sample_input_flags = get_sample_flags(SAMPLE_MODE)
32
  if not sample_input_flags:
33
  return "Error: sample_mode can only be 'cross' or 'reconstruction'"
@@ -53,7 +47,7 @@ def generate_video(audio_file, video_file):
53
  )
54
  GEN_FLAGS = (
55
  f"--generate_from_filelist {GENERATE_FROM_FILELIST} "
56
- f"--video_path={INPUT_VIDEO_PATH} --audio_path={INPUT_AUDIO_PATH} "
57
  f"--out_path={OUTPUT_VIDEO_PATH} --save_orig=False "
58
  f"--face_det_batch_size 16 --pads {PADS} --is_voxceleb2=False"
59
  )
@@ -77,8 +71,8 @@ with gr.Blocks() as demo:
77
  gr.Markdown("## Audio-Video Synthesis Model")
78
 
79
  with gr.Row():
80
- audio_input = gr.Audio(label="Upload Audio", type="file")
81
- video_input = gr.Video(label="Upload Video", type="file")
82
 
83
  output_video = gr.Video(label="Generated Video")
84
 
 
3
  import subprocess
4
 
5
  # Define the paths where the input and output files will be stored
 
 
6
  OUTPUT_VIDEO_PATH = "output_video.mp4"
7
  MODEL_PATH = "checkpoints/checkpoint.pt"
8
 
 
21
  return None
22
 
23
  # Function to run the model inference command
24
+ def generate_video(audio_path, video_path):
 
 
 
 
25
  sample_input_flags = get_sample_flags(SAMPLE_MODE)
26
  if not sample_input_flags:
27
  return "Error: sample_mode can only be 'cross' or 'reconstruction'"
 
47
  )
48
  GEN_FLAGS = (
49
  f"--generate_from_filelist {GENERATE_FROM_FILELIST} "
50
+ f"--video_path={video_path} --audio_path={audio_path} "
51
  f"--out_path={OUTPUT_VIDEO_PATH} --save_orig=False "
52
  f"--face_det_batch_size 16 --pads {PADS} --is_voxceleb2=False"
53
  )
 
71
  gr.Markdown("## Audio-Video Synthesis Model")
72
 
73
  with gr.Row():
74
+ audio_input = gr.Audio(label="Upload Audio", type="filepath")
75
+ video_input = gr.Video(label="Upload Video", type="filepath")
76
 
77
  output_video = gr.Video(label="Generated Video")
78