Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -11,10 +11,8 @@ from pipelines.pipeline import InferencePipeline
|
|
11 |
|
12 |
FFMPEG_COMMAND = "-loglevel error -y -r 25 -pix_fmt yuv420p -f mp4"
|
13 |
pipelines = {
|
14 |
-
"VSR": InferencePipeline("./configs/LRS3_V_WER19.1.ini", device="cuda:0", face_track=True, detector="retinaface"),
|
15 |
"VSR(fast)": InferencePipeline("./configs/LRS3_V_WER19.1.ini", device="cuda:0", face_track=True, detector="mediapipe"),
|
16 |
"ASR": InferencePipeline("./configs/LRS3_A_WER1.0.ini", device="cuda:0", face_track=True, detector="retinaface"),
|
17 |
-
"AVSR": InferencePipeline("./configs/LRS3_AV_WER0.9.ini", device="cuda:0", face_track=True, detector="retinaface"),
|
18 |
"AVSR(fast)": InferencePipeline("./configs/LRS3_AV_WER0.9.ini", device="cuda:0", face_track=True, detector="mediapipe")
|
19 |
}
|
20 |
print("Step 0. Model has been loaded.")
|
@@ -23,17 +21,13 @@ def fn(pipeline_type, filename):
|
|
23 |
directory = "./tmp_video"
|
24 |
if not os.path.exists(directory):
|
25 |
os.makedirs(directory)
|
26 |
-
now = datetime.datetime.now()
|
27 |
-
timestamp = now.strftime("%Y-%m-%d_%H-%M-%S")
|
28 |
-
dst_filename = f"{directory}/file_{timestamp}.mp4"
|
29 |
-
command_string = f"ffmpeg -i {filename} {FFMPEG_COMMAND} {dst_filename}"
|
30 |
print("Step 0. Video has been uploaded.")
|
31 |
os.system(command_string)
|
32 |
selected_pipeline_instance = pipelines[pipeline_type]
|
33 |
print("Step 1. Video has been converted.")
|
34 |
-
landmarks = selected_pipeline_instance.process_landmarks(
|
35 |
print("Step 2. Landmarks have been detected.")
|
36 |
-
data = selected_pipeline_instance.dataloader.load_data(
|
37 |
print("Step 3. Data has been preprocessed.")
|
38 |
transcript = selected_pipeline_instance.model.infer(data)
|
39 |
print("Step 4. Inference has been done.")
|
@@ -74,8 +68,9 @@ with demo:
|
|
74 |
gr.HTML(
|
75 |
"""
|
76 |
<div class="acknowledgments">
|
|
|
77 |
<p> We share this demo only for non-commercial purposes. </p>
|
78 |
-
|
79 |
"""
|
80 |
)
|
81 |
|
|
|
11 |
|
12 |
FFMPEG_COMMAND = "-loglevel error -y -r 25 -pix_fmt yuv420p -f mp4"
|
13 |
pipelines = {
|
|
|
14 |
"VSR(fast)": InferencePipeline("./configs/LRS3_V_WER19.1.ini", device="cuda:0", face_track=True, detector="mediapipe"),
|
15 |
"ASR": InferencePipeline("./configs/LRS3_A_WER1.0.ini", device="cuda:0", face_track=True, detector="retinaface"),
|
|
|
16 |
"AVSR(fast)": InferencePipeline("./configs/LRS3_AV_WER0.9.ini", device="cuda:0", face_track=True, detector="mediapipe")
|
17 |
}
|
18 |
print("Step 0. Model has been loaded.")
|
|
|
21 |
directory = "./tmp_video"
|
22 |
if not os.path.exists(directory):
|
23 |
os.makedirs(directory)
|
|
|
|
|
|
|
|
|
24 |
print("Step 0. Video has been uploaded.")
|
25 |
os.system(command_string)
|
26 |
selected_pipeline_instance = pipelines[pipeline_type]
|
27 |
print("Step 1. Video has been converted.")
|
28 |
+
landmarks = selected_pipeline_instance.process_landmarks(filename, landmarks_filename=None)
|
29 |
print("Step 2. Landmarks have been detected.")
|
30 |
+
data = selected_pipeline_instance.dataloader.load_data(filename, landmarks)
|
31 |
print("Step 3. Data has been preprocessed.")
|
32 |
transcript = selected_pipeline_instance.model.infer(data)
|
33 |
print("Step 4. Inference has been done.")
|
|
|
68 |
gr.HTML(
|
69 |
"""
|
70 |
<div class="acknowledgments">
|
71 |
+
<p> We used retinaface for training, but for the demo we used mediapipe </p>
|
72 |
<p> We share this demo only for non-commercial purposes. </p>
|
73 |
+
</div>
|
74 |
"""
|
75 |
)
|
76 |
|