marquesafonso
commited on
add tab selection
Browse files
app.py
CHANGED
@@ -5,36 +5,36 @@ def main():
|
|
5 |
with gr.Blocks(title='multilang-asr-transcriber', delete_cache=(86400, 86400), theme=gr.themes.Base()) as demo:
|
6 |
gr.Markdown('## Multilang ASR Transcriber')
|
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 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
demo.launch()
|
39 |
|
40 |
if __name__ == '__main__':
|
|
|
5 |
with gr.Blocks(title='multilang-asr-transcriber', delete_cache=(86400, 86400), theme=gr.themes.Base()) as demo:
|
6 |
gr.Markdown('## Multilang ASR Transcriber')
|
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")
|
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", "large-v3"], value="deepdml/faster-whisper-large-v3-turbo-ct2", label="Select Model")
|
16 |
+
text_output = gr.Textbox(label="SRT Text transcription", show_copy_button=True)
|
17 |
+
srt_file = gr.File(file_count="single", type="filepath", file_types=[".srt"], label="SRT file")
|
18 |
+
text_clean_output = gr.Textbox(label="Text transcription", show_copy_button=True)
|
19 |
+
gr.Interface(transcriber,
|
20 |
+
inputs=[file, file_type, max_words_per_line, task, model_version],
|
21 |
+
outputs=[text_output, srt_file, text_clean_output],
|
22 |
+
allow_flagging="never")
|
23 |
+
|
24 |
+
with gr.Tab("Audio", id = "audio"):
|
25 |
+
video = False
|
26 |
+
file = gr.File(file_types=["audio"],type="filepath", label="Upload an audio file")
|
27 |
+
file_type = gr.Radio(choices=["audio"], value="audio", label="File Type")
|
28 |
+
max_words_per_line = gr.Number(value=6, label="Max words per line")
|
29 |
+
task = gr.Radio(choices=["transcribe", "translate"], value="transcribe", label="Select Task")
|
30 |
+
model_version = gr.Radio(choices=["deepdml/faster-whisper-large-v3-turbo-ct2", "large-v3"], value="deepdml/faster-whisper-large-v3-turbo-ct2", label="Select Model")
|
31 |
+
text_output = gr.Textbox(label="SRT Text transcription", show_copy_button=True)
|
32 |
+
srt_file = gr.File(file_count="single", type="filepath", file_types=[".srt"], label="SRT file")
|
33 |
+
text_clean_output = gr.Textbox(label="Text transcription", show_copy_button=True)
|
34 |
+
gr.Interface(transcriber,
|
35 |
+
inputs=[file, file_type, max_words_per_line, task, model_version],
|
36 |
+
outputs=[text_output, srt_file, text_clean_output],
|
37 |
+
allow_flagging="never")
|
38 |
demo.launch()
|
39 |
|
40 |
if __name__ == '__main__':
|