Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,69 @@ import os
|
|
2 |
import gradio as gr
|
3 |
from pipelines.pipeline import InferencePipeline
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
pipelines = {
|
6 |
"VSR(mediapipe)": InferencePipeline("./configs/LRS3_V_WER19.1.ini", device="cpu", face_track=True, detector="mediapipe"),
|
7 |
"ASR": InferencePipeline("./configs/LRS3_A_WER1.0.ini", device="cpu", face_track=True, detector="mediapipe"),
|
@@ -22,26 +85,11 @@ def fn(pipeline_type, filename):
|
|
22 |
print(f"transcript: {transcript}")
|
23 |
return transcript
|
24 |
|
25 |
-
demo = gr.Blocks()
|
26 |
|
27 |
with demo:
|
28 |
|
29 |
-
gr.HTML(
|
30 |
-
"""
|
31 |
-
<div style="text-align: center; max-width: 1200px; margin: 20px auto;">
|
32 |
-
<h1 style="font-weight: 900; font-size: 3rem; margin: 0rem">
|
33 |
-
Auto-AVSR
|
34 |
-
</h1>
|
35 |
-
<h3 style="font-weight: 450; font-size: 1rem; margin: 0rem">
|
36 |
-
[<a href="https://arxiv.org/abs/2303.14307" style="color:blue;">arXiv</a>]
|
37 |
-
[<a href="https://github.com/mpc001/auto_avsr" style="color:blue;">Code</a>]
|
38 |
-
</h3>
|
39 |
-
<h2 style="text-align: left; font-weight: 450; font-size: 1rem; margin-top: 0.5rem; margin-bottom: 0.5rem">
|
40 |
-
🔥 <b>Notes</b>: We share this demo only for non-commercial purposes.
|
41 |
-
</h2>
|
42 |
-
|
43 |
-
</div>
|
44 |
-
""")
|
45 |
|
46 |
|
47 |
dropdown_list = gr.inputs.Dropdown(["ASR", "VSR(mediapipe)", "AVSR(mediapipe)"], label="model")
|
@@ -51,4 +99,6 @@ with demo:
|
|
51 |
|
52 |
btn.click(fn, inputs=[dropdown_list, video_file], outputs=text)
|
53 |
|
|
|
|
|
54 |
demo.launch()
|
|
|
2 |
import gradio as gr
|
3 |
from pipelines.pipeline import InferencePipeline
|
4 |
|
5 |
+
TITLE = """
|
6 |
+
<div style="text-align: center; max-width: 650px; margin: 0 auto;">
|
7 |
+
<div
|
8 |
+
style="
|
9 |
+
display: inline-flex;
|
10 |
+
align-items: center;
|
11 |
+
gap: 0.8rem;
|
12 |
+
font-size: 1.75rem;
|
13 |
+
"
|
14 |
+
>
|
15 |
+
<h1 style="font-weight: 900; margin-bottom: 7px;">
|
16 |
+
Auto-AVSR: Audio-Visual Speech Recognition with Automatic Labels
|
17 |
+
</h1>
|
18 |
+
<h3 style="font-weight: 450; font-size: 1rem; margin: 0rem">
|
19 |
+
[<a href="https://arxiv.org/abs/2303.14307" style="color:blue;">arXiv</a>]
|
20 |
+
[<a href="https://github.com/mpc001/auto_avsr" style="color:blue;">Code</a>]
|
21 |
+
</h3>
|
22 |
+
</div>
|
23 |
+
<p style="margin-bottom: 10px; font-size: 94%">
|
24 |
+
Want to recognise the content from audio or visual information?<br>The Auto-AVSR is here to get you answers!
|
25 |
+
</p>
|
26 |
+
</div>
|
27 |
+
"""
|
28 |
+
|
29 |
+
ARTICLE = """
|
30 |
+
<div style="text-align: center; max-width: 650px; margin: 0 auto;">
|
31 |
+
<p>
|
32 |
+
Server busy? You can also run on <a href="https://colab.research.google.com/drive/1jfb6e4xxhXHbmQf-nncdLno1u0b4j614?usp=sharing">Google Colab</a>
|
33 |
+
</p>
|
34 |
+
<p>
|
35 |
+
We share this demo only for non-commercial purposes.
|
36 |
+
</p>
|
37 |
+
</div>
|
38 |
+
"""
|
39 |
+
|
40 |
+
CSS = """
|
41 |
+
#col-container {margin-left: auto; margin-right: auto;}
|
42 |
+
a {text-decoration-line: underline; font-weight: 600;}
|
43 |
+
.animate-spin {
|
44 |
+
animation: spin 1s linear infinite;
|
45 |
+
}
|
46 |
+
@keyframes spin {
|
47 |
+
from { transform: rotate(0deg); }
|
48 |
+
to { transform: rotate(360deg); }
|
49 |
+
}
|
50 |
+
#share-btn-container {
|
51 |
+
display: flex; padding-left: 0.5rem !important; padding-right: 0.5rem !important; background-color: #000000; justify-content: center; align-items: center; border-radius: 9999px !important; width: 13rem;
|
52 |
+
}
|
53 |
+
#share-btn {
|
54 |
+
all: initial; color: #ffffff;font-weight: 600; cursor:pointer; font-family: 'IBM Plex Sans', sans-serif; margin-left: 0.5rem !important; padding-top: 0.25rem !important; padding-bottom: 0.25rem !important;
|
55 |
+
}
|
56 |
+
#share-btn * {
|
57 |
+
all: unset;
|
58 |
+
}
|
59 |
+
#share-btn-container div:nth-child(-n+2){
|
60 |
+
width: auto !important;
|
61 |
+
min-height: 0px !important;
|
62 |
+
}
|
63 |
+
#share-btn-container .wrap {
|
64 |
+
display: none !important;
|
65 |
+
}
|
66 |
+
"""
|
67 |
+
|
68 |
pipelines = {
|
69 |
"VSR(mediapipe)": InferencePipeline("./configs/LRS3_V_WER19.1.ini", device="cpu", face_track=True, detector="mediapipe"),
|
70 |
"ASR": InferencePipeline("./configs/LRS3_A_WER1.0.ini", device="cpu", face_track=True, detector="mediapipe"),
|
|
|
85 |
print(f"transcript: {transcript}")
|
86 |
return transcript
|
87 |
|
88 |
+
demo = gr.Blocks(css=CSS)
|
89 |
|
90 |
with demo:
|
91 |
|
92 |
+
gr.HTML(TITLE)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
|
95 |
dropdown_list = gr.inputs.Dropdown(["ASR", "VSR(mediapipe)", "AVSR(mediapipe)"], label="model")
|
|
|
99 |
|
100 |
btn.click(fn, inputs=[dropdown_list, video_file], outputs=text)
|
101 |
|
102 |
+
gr.HTML(ARTICLE)
|
103 |
+
|
104 |
demo.launch()
|