Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,19 @@
|
|
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,33 +29,8 @@ os.system('pip install transformers')
|
|
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 |
-
print(sys.path)
|
23 |
-
print(os.listdir())
|
24 |
-
print(sys.argv, type(sys.argv))
|
25 |
-
sys.argv.append('dummy')
|
26 |
-
|
27 |
-
|
28 |
-
import dlib, cv2, os
|
29 |
-
import numpy as np
|
30 |
-
import skvideo
|
31 |
-
import skvideo.io
|
32 |
-
from tqdm import tqdm
|
33 |
-
from preparation.align_mouth import landmarks_interpolate, crop_patch, write_video_ffmpeg
|
34 |
-
from base64 import b64encode
|
35 |
-
import torch
|
36 |
-
import cv2
|
37 |
-
import tempfile
|
38 |
-
from argparse import Namespace
|
39 |
-
import fairseq
|
40 |
-
from fairseq import checkpoint_utils, options, tasks, utils
|
41 |
-
from fairseq.dataclass.configs import GenerationConfig
|
42 |
-
from huggingface_hub import hf_hub_download
|
43 |
-
import gradio as gr
|
44 |
-
from pytube import YouTube
|
45 |
-
|
46 |
user_dir = "/home/user/app/av_hubert/avhubert"
|
47 |
utils.import_user_module(Namespace(user_dir=user_dir))
|
48 |
data_dir = "/home/user/app/video"
|
@@ -199,14 +187,9 @@ with demo:
|
|
199 |
video_out])
|
200 |
predict_btn = gr.Button("Predict")
|
201 |
predict_btn.click(predict, [video_out], [
|
202 |
-
text_output])
|
203 |
-
|
204 |
-
# Download XML button
|
205 |
-
download_xml_btn = gr.Button("Download XML")
|
206 |
-
download_xml_btn.click(lambda: xml_output.download("transcript.xml"))
|
207 |
-
|
208 |
with gr.Row():
|
209 |
text_output.render()
|
210 |
xml_output.render()
|
211 |
|
212 |
-
demo.launch(debug=True)
|
|
|
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 |
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"
|
|
|
187 |
video_out])
|
188 |
predict_btn = gr.Button("Predict")
|
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)
|