Suprath commited on
Commit
7bb32ce
·
verified ·
1 Parent(s): 6ea2426

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -14
app.py CHANGED
@@ -1,19 +1,6 @@
1
  import os
2
  import sys
3
  import xml.etree.ElementTree as ET
4
- import gradio as gr
5
- import cv2
6
- import dlib
7
- import numpy as np
8
- import skvideo.io
9
- import torch
10
- from argparse import Namespace
11
- from base64 import b64encode
12
- from huggingface_hub import hf_hub_download
13
- from pytube import YouTube
14
- from tqdm import tqdm
15
- from fairseq import checkpoint_utils, tasks, utils
16
- from fairseq.dataclass.configs import GenerationConfig
17
 
18
  os.system('git clone https://github.com/facebookresearch/av_hubert.git')
19
  os.chdir('/home/user/app/av_hubert')
@@ -29,8 +16,27 @@ os.system('pip install transformers')
29
  os.system('pip install gradio==3.12')
30
  os.system('pip install numpy==1.23.3')
31
 
 
32
  sys.path.append('/home/user/app/av_hubert/avhubert')
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  user_dir = "/home/user/app/av_hubert/avhubert"
35
  utils.import_user_module(Namespace(user_dir=user_dir))
36
  data_dir = "/home/user/app/video"
@@ -133,6 +139,7 @@ def predict(process_video):
133
 
134
  return hypo, "transcript.xml"
135
 
 
136
  # ---- Gradio Layout -----
137
  youtube_url_in = gr.Textbox(label="Youtube url", lines=1, interactive=True)
138
  video_in = gr.Video(label="Input Video", mirror_webcam=False, interactive=True)
@@ -189,7 +196,9 @@ with demo:
189
  predict_btn.click(predict, [video_out], [
190
  text_output, xml_output])
191
  with gr.Row():
 
192
  text_output.render()
193
- xml_output.render()
194
 
 
 
195
  demo.launch(debug=True)
 
1
  import os
2
  import sys
3
  import xml.etree.ElementTree as ET
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  os.system('git clone https://github.com/facebookresearch/av_hubert.git')
6
  os.chdir('/home/user/app/av_hubert')
 
16
  os.system('pip install gradio==3.12')
17
  os.system('pip install numpy==1.23.3')
18
 
19
+
20
  sys.path.append('/home/user/app/av_hubert/avhubert')
21
 
22
+ import dlib, cv2, os
23
+ import numpy as np
24
+ import skvideo
25
+ import skvideo.io
26
+ from tqdm import tqdm
27
+ from preparation.align_mouth import landmarks_interpolate, crop_patch, write_video_ffmpeg
28
+ from base64 import b64encode
29
+ import torch
30
+ import cv2
31
+ import tempfile
32
+ from argparse import Namespace
33
+ import fairseq
34
+ from fairseq import checkpoint_utils, options, tasks, utils
35
+ from fairseq.dataclass.configs import GenerationConfig
36
+ from huggingface_hub import hf_hub_download
37
+ import gradio as gr
38
+ from pytube import YouTube
39
+
40
  user_dir = "/home/user/app/av_hubert/avhubert"
41
  utils.import_user_module(Namespace(user_dir=user_dir))
42
  data_dir = "/home/user/app/video"
 
139
 
140
  return hypo, "transcript.xml"
141
 
142
+
143
  # ---- Gradio Layout -----
144
  youtube_url_in = gr.Textbox(label="Youtube url", lines=1, interactive=True)
145
  video_in = gr.Video(label="Input Video", mirror_webcam=False, interactive=True)
 
196
  predict_btn.click(predict, [video_out], [
197
  text_output, xml_output])
198
  with gr.Row():
199
+ # video_lip = gr.Video(label="Audio Visual Video", mirror_webcam=False)
200
  text_output.render()
 
201
 
202
+
203
+
204
  demo.launch(debug=True)