add audio option - needs follow up in transcriber.py
Browse files
app.py
CHANGED
|
@@ -2,10 +2,28 @@ import gradio as gr
|
|
| 2 |
from src.transcriber import transcriber
|
| 3 |
|
| 4 |
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 |
max_words_per_line = gr.Number(value=6, label="Max words per line")
|
| 10 |
task = gr.Radio(choices=["transcribe", "translate"], value="transcribe", label="Select Task")
|
| 11 |
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")
|
|
@@ -13,7 +31,7 @@ def main():
|
|
| 13 |
srt_file = gr.File(file_count="single", type="filepath", file_types=[".srt"], label="SRT file")
|
| 14 |
text_clean_output = gr.Textbox(label="Text transcription", show_copy_button=True)
|
| 15 |
gr.Interface(transcriber,
|
| 16 |
-
inputs=[
|
| 17 |
outputs=[text_output, srt_file, text_clean_output],
|
| 18 |
allow_flagging="never")
|
| 19 |
demo.launch()
|
|
|
|
| 2 |
from src.transcriber import transcriber
|
| 3 |
|
| 4 |
def main():
|
| 5 |
+
|
| 6 |
+
audio_chunked = gr.Interface(
|
| 7 |
+
fn=transcribe_chunked_audio,
|
| 8 |
+
inputs=[
|
| 9 |
+
gr.Audio(sources=["upload"], label="Audio file", type="filepath"),
|
| 10 |
+
gr.Radio(["transcribe", "translate"], label="Task", value="transcribe"),
|
| 11 |
+
gr.Checkbox(value=False, label="Return timestamps"),
|
| 12 |
+
],
|
| 13 |
+
outputs=[
|
| 14 |
+
gr.Textbox(label="Transcription", show_copy_button=True),
|
| 15 |
+
gr.Textbox(label="Transcription Time (s)"),
|
| 16 |
+
],
|
| 17 |
+
allow_flagging="never",
|
| 18 |
+
title=title,
|
| 19 |
+
description=description,
|
| 20 |
+
article=article,
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
with gr.Blocks(title='multilang-asr-transcriber', delete_cache=(86400, 86400), theme=gr.themes.Base()) as demo:
|
| 24 |
gr.Markdown('## Multilang ASR Transcriber')
|
| 25 |
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.')
|
| 26 |
+
file = gr.File(file_types=["video", "audio"],type="filepath", label="Upload video or audio")
|
| 27 |
max_words_per_line = gr.Number(value=6, label="Max words per line")
|
| 28 |
task = gr.Radio(choices=["transcribe", "translate"], value="transcribe", label="Select Task")
|
| 29 |
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 |
srt_file = gr.File(file_count="single", type="filepath", file_types=[".srt"], label="SRT file")
|
| 32 |
text_clean_output = gr.Textbox(label="Text transcription", show_copy_button=True)
|
| 33 |
gr.Interface(transcriber,
|
| 34 |
+
inputs=[file, max_words_per_line, task, model_version],
|
| 35 |
outputs=[text_output, srt_file, text_clean_output],
|
| 36 |
allow_flagging="never")
|
| 37 |
demo.launch()
|