Commit
·
fc138bd
1
Parent(s):
33d3f17
return to gr.interface fix
Browse files
app.py
CHANGED
@@ -7,49 +7,42 @@ def main():
|
|
7 |
gr.Markdown('An automatic speech recognition tool using [faster-whisper](https://github.com/SYSTRAN/faster-whisper). Supports multilingual video transcription and translation to english. Users may set the max words per line.')
|
8 |
with gr.Tabs(selected="video") as tabs:
|
9 |
with gr.Tab("Video", id="video"):
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
text_output = gr.Textbox(label="SRT Text transcription")
|
22 |
-
srt_file = gr.File(value=None, file_count="single", type="filepath", file_types=[".srt"], label="SRT file")
|
23 |
-
text_clean_output = gr.Textbox(label="Text transcription")
|
24 |
gr.Interface(
|
25 |
fn=transcriber,
|
26 |
inputs=[file, file_type, max_words_per_line, task, model_version],
|
27 |
outputs=[text_output, srt_file, text_clean_output],
|
28 |
allow_flagging="never"
|
29 |
)
|
30 |
-
|
31 |
with gr.Tab("Audio", id = "audio"):
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
allow_flagging="never"
|
51 |
-
)
|
52 |
-
demo.launch()
|
53 |
|
54 |
if __name__ == '__main__':
|
55 |
main()
|
|
|
7 |
gr.Markdown('An automatic speech recognition tool using [faster-whisper](https://github.com/SYSTRAN/faster-whisper). Supports multilingual video transcription and translation to english. Users may set the max words per line.')
|
8 |
with gr.Tabs(selected="video") as tabs:
|
9 |
with gr.Tab("Video", id="video"):
|
10 |
+
video = True
|
11 |
+
file = gr.File(file_types=["video"],type="filepath", label="Upload a video")
|
12 |
+
file_type = gr.Radio(choices=["video"], value="video", label="File Type", visible=False)
|
13 |
+
max_words_per_line = gr.Number(value=6, label="Max words per line")
|
14 |
+
task = gr.Radio(choices=["transcribe", "translate"], value="transcribe", label="Select Task")
|
15 |
+
model_version = gr.Radio(choices=["deepdml/faster-whisper-large-v3-turbo-ct2",
|
16 |
+
"turbo",
|
17 |
+
"large-v3"], value="deepdml/faster-whisper-large-v3-turbo-ct2", label="Select Model")
|
18 |
+
text_output = gr.Textbox(label="SRT Text transcription")
|
19 |
+
srt_file = gr.File(value=None, file_count="single", type="filepath", file_types=[".srt"], label="SRT file")
|
20 |
+
text_clean_output = gr.Textbox(label="Text transcription")
|
|
|
|
|
|
|
21 |
gr.Interface(
|
22 |
fn=transcriber,
|
23 |
inputs=[file, file_type, max_words_per_line, task, model_version],
|
24 |
outputs=[text_output, srt_file, text_clean_output],
|
25 |
allow_flagging="never"
|
26 |
)
|
|
|
27 |
with gr.Tab("Audio", id = "audio"):
|
28 |
+
video = False
|
29 |
+
file = gr.File(file_types=["audio"],type="filepath", label="Upload an audio file")
|
30 |
+
file_type = gr.Radio(choices=["audio"], value="audio", label="File Type", visible=False)
|
31 |
+
max_words_per_line = gr.Number(value=6, label="Max words per line")
|
32 |
+
task = gr.Radio(choices=["transcribe", "translate"], value="transcribe", label="Select Task")
|
33 |
+
model_version = gr.Radio(choices=["deepdml/faster-whisper-large-v3-turbo-ct2",
|
34 |
+
"turbo",
|
35 |
+
"large-v3"], value="deepdml/faster-whisper-large-v3-turbo-ct2", label="Select Model")
|
36 |
+
text_output = gr.Textbox(label="SRT Text transcription")
|
37 |
+
srt_file = gr.File(value=None, file_count="single", type="filepath", file_types=[".srt"], label="SRT file")
|
38 |
+
text_clean_output = gr.Textbox(label="Text transcription")
|
39 |
+
gr.Interface(
|
40 |
+
fn=transcriber,
|
41 |
+
inputs=[file, file_type, max_words_per_line, task, model_version],
|
42 |
+
outputs=[text_output, srt_file, text_clean_output],
|
43 |
+
allow_flagging="never"
|
44 |
+
)
|
45 |
+
demo.launch()
|
|
|
|
|
|
|
46 |
|
47 |
if __name__ == '__main__':
|
48 |
main()
|