harlanhong commited on
Commit
712c167
1 Parent(s): 00fef5d
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -17,7 +17,7 @@ examples = [['project/cartoon2.jpg','project/video1.mp4'],
17
 
18
  title = "DaGAN"
19
  description = """
20
- Gradio demo for <b>Depth-Aware Generative Adversarial Network for Talking Head Video Generation</b>, CVPR 2022L. <a href='https://arxiv.org/abs/2203.06605'>[Paper]</a><a href='https://github.com/harlanhong/CVPR2022-DaGAN'>[Github Code]</a>\n
21
  """
22
  ##With Restormer, you can perform: (1) Image Denoising, (2) Defocus Deblurring, (3) Motion Deblurring, and (4) Image Deraining.
23
  ##To use it, simply upload your own image, or click one of the examples provided below.
@@ -28,6 +28,10 @@ article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2203.066
28
  def inference(img, video):
29
  if not os.path.exists('temp'):
30
  os.system('mkdir temp')
 
 
 
 
31
  #### Resize the longer edge of the input image
32
  # os.system("ffmpeg -y -ss 00:00:00 -i {video} -to 00:00:08 -c copy temp/driving_video.mp4")
33
  # driving_video = "video_input.mp4"
@@ -38,7 +42,7 @@ gr.Interface(
38
  inference,
39
  [
40
  gr.inputs.Image(type="filepath", label="Source Image"),
41
- gr.inputs.Video(type='filepath',label="Driving Video"),
42
  ],
43
  gr.outputs.Video(type="mp4", label="Output Video"),
44
  title=title,
 
17
 
18
  title = "DaGAN"
19
  description = """
20
+ Gradio demo for <b>Depth-Aware Generative Adversarial Network for Talking Head Video Generation</b>, CVPR 2022. <a href='https://arxiv.org/abs/2203.06605'>[Paper]</a><a href='https://github.com/harlanhong/CVPR2022-DaGAN'>[Github Code]</a>\n
21
  """
22
  ##With Restormer, you can perform: (1) Image Denoising, (2) Defocus Deblurring, (3) Motion Deblurring, and (4) Image Deraining.
23
  ##To use it, simply upload your own image, or click one of the examples provided below.
 
28
  def inference(img, video):
29
  if not os.path.exists('temp'):
30
  os.system('mkdir temp')
31
+ # trim video to 8 seconds
32
+ cmd = f"ffmpeg -y -ss 00:00:00 -i {video} -to 00:00:08 -c copy video_input.mp4"
33
+ subprocess.run(cmd.split())
34
+ video = "video_input.mp4"
35
  #### Resize the longer edge of the input image
36
  # os.system("ffmpeg -y -ss 00:00:00 -i {video} -to 00:00:08 -c copy temp/driving_video.mp4")
37
  # driving_video = "video_input.mp4"
 
42
  inference,
43
  [
44
  gr.inputs.Image(type="filepath", label="Source Image"),
45
+ gr.inputs.Video(type='mp4',label="Driving Video"),
46
  ],
47
  gr.outputs.Video(type="mp4", label="Output Video"),
48
  title=title,