Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -370,8 +370,54 @@ with gr.Blocks() as interface:
|
|
370 |
"""
|
371 |
)
|
372 |
with gr.Tabs():
|
373 |
-
with gr.
|
374 |
-
with gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
375 |
with gr.Column(scale=1, min_width=250):
|
376 |
model = gr.Dropdown(
|
377 |
choices=[
|
@@ -425,62 +471,6 @@ with gr.Blocks() as interface:
|
|
425 |
],
|
426 |
)
|
427 |
model.change(update_max_tokens, inputs=[model], outputs=max_tokens)
|
428 |
-
with gr.TabItem("Speech To Text"):
|
429 |
-
with gr.Tabs():
|
430 |
-
with gr.TabItem("Transcription"):
|
431 |
-
gr.Markdown("Transcript audio from files to text!")
|
432 |
-
with gr.Row():
|
433 |
-
audio_input = gr.File(
|
434 |
-
type="filepath", label="Upload File containing Audio", file_types=[f".{ext}" for ext in ALLOWED_FILE_EXTENSIONS]
|
435 |
-
)
|
436 |
-
model_choice_transcribe = gr.Dropdown(
|
437 |
-
choices=["whisper-large-v3"],
|
438 |
-
value="whisper-large-v3",
|
439 |
-
label="Model",
|
440 |
-
)
|
441 |
-
with gr.Row():
|
442 |
-
transcribe_prompt = gr.Textbox(
|
443 |
-
label="Prompt (Optional)",
|
444 |
-
info="Specify any context or spelling corrections.",
|
445 |
-
)
|
446 |
-
with gr.Column():
|
447 |
-
language = gr.Dropdown(
|
448 |
-
choices=[(lang, code) for lang, code in LANGUAGE_CODES.items()],
|
449 |
-
value="en",
|
450 |
-
label="Language",
|
451 |
-
)
|
452 |
-
auto_detect_language = gr.Checkbox(label="Auto Detect Language")
|
453 |
-
transcribe_button = gr.Button("Transcribe")
|
454 |
-
transcription_output = gr.Textbox(label="Transcription")
|
455 |
-
merged_audio_output = gr.File(label="Merged Audio (if chunked)")
|
456 |
-
transcribe_button.click(
|
457 |
-
transcribe_audio,
|
458 |
-
inputs=[audio_input, model_choice_transcribe, transcribe_prompt, language, auto_detect_language],
|
459 |
-
outputs=[transcription_output, merged_audio_output],
|
460 |
-
)
|
461 |
-
with gr.TabItem("Translation"):
|
462 |
-
gr.Markdown("Transcript audio from files and translate them to English text!")
|
463 |
-
with gr.Row():
|
464 |
-
audio_input_translate = gr.File(
|
465 |
-
type="filepath", label="Upload File containing Audio", file_types=[f".{ext}" for ext in ALLOWED_FILE_EXTENSIONS]
|
466 |
-
)
|
467 |
-
model_choice_translate = gr.Dropdown(
|
468 |
-
choices=["whisper-large-v3"],
|
469 |
-
value="whisper-large-v3",
|
470 |
-
label="Audio Speech Recognition (ASR) Model",
|
471 |
-
)
|
472 |
-
with gr.Row():
|
473 |
-
translate_prompt = gr.Textbox(
|
474 |
-
label="Prompt (Optional)",
|
475 |
-
info="Specify any context or spelling corrections.",
|
476 |
-
)
|
477 |
-
translate_button = gr.Button("Translate")
|
478 |
-
translation_output = gr.Textbox(label="Translation")
|
479 |
-
translate_button.click(
|
480 |
-
translate_audio,
|
481 |
-
inputs=[audio_input_translate, model_choice_translate, translate_prompt],
|
482 |
-
outputs=translation_output,
|
483 |
-
)
|
484 |
|
485 |
|
486 |
interface.launch(share=True)
|
|
|
370 |
"""
|
371 |
)
|
372 |
with gr.Tabs():
|
373 |
+
with gr.Tabs():
|
374 |
+
with gr.TabItem("Transcription"):
|
375 |
+
gr.Markdown("Transcript audio from files to text!")
|
376 |
+
with gr.Row():
|
377 |
+
audio_input = gr.File(type="filepath", label="Upload File containing Audio", file_types=[f".{ext}" for ext in ALLOWED_FILE_EXTENSIONS])
|
378 |
+
model_choice_transcribe = gr.Dropdown(choices=["whisper-large-v3"],value="whisper-large-v3",label="Model")
|
379 |
+
with gr.Row():
|
380 |
+
transcribe_prompt = gr.Textbox(label="Prompt (Optional)",info="Specify any context or spelling corrections.")
|
381 |
+
with gr.Column():
|
382 |
+
language = gr.Dropdown(
|
383 |
+
choices=[(lang, code) for lang, code in LANGUAGE_CODES.items()],
|
384 |
+
value="en",
|
385 |
+
label="Language",
|
386 |
+
)
|
387 |
+
|
388 |
+
auto_detect_language = gr.Checkbox(label="Auto Detect Language")
|
389 |
+
transcribe_button = gr.Button("Transcribe")
|
390 |
+
transcription_output = gr.Textbox(label="Transcription")
|
391 |
+
merged_audio_output = gr.File(label="Merged Audio (if chunked)")
|
392 |
+
transcribe_button.click(
|
393 |
+
transcribe_audio,
|
394 |
+
inputs=[audio_input, model_choice_transcribe, transcribe_prompt, language, auto_detect_language],
|
395 |
+
outputs=[transcription_output, merged_audio_output],
|
396 |
+
)
|
397 |
+
with gr.TabItem("Translation"):
|
398 |
+
gr.Markdown("Transcript audio from files and translate them to English text!")
|
399 |
+
with gr.Row():
|
400 |
+
audio_input_translate = gr.File(
|
401 |
+
type="filepath", label="Upload File containing Audio", file_types=[f".{ext}" for ext in ALLOWED_FILE_EXTENSIONS]
|
402 |
+
)
|
403 |
+
model_choice_translate = gr.Dropdown(
|
404 |
+
choices=["whisper-large-v3"],
|
405 |
+
value="whisper-large-v3",
|
406 |
+
label="Audio Speech Recognition (ASR) Model",
|
407 |
+
)
|
408 |
+
with gr.Row():
|
409 |
+
translate_prompt = gr.Textbox(
|
410 |
+
label="Prompt (Optional)",
|
411 |
+
info="Specify any context or spelling corrections.",
|
412 |
+
)
|
413 |
+
translate_button = gr.Button("Translate")
|
414 |
+
translation_output = gr.Textbox(label="Translation")
|
415 |
+
translate_button.click(
|
416 |
+
translate_audio,
|
417 |
+
inputs=[audio_input_translate, model_choice_translate, translate_prompt],
|
418 |
+
outputs=translation_output,
|
419 |
+
)
|
420 |
+
with gr.TabItem("LLMs"):
|
421 |
with gr.Column(scale=1, min_width=250):
|
422 |
model = gr.Dropdown(
|
423 |
choices=[
|
|
|
471 |
],
|
472 |
)
|
473 |
model.change(update_max_tokens, inputs=[model], outputs=max_tokens)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
474 |
|
475 |
|
476 |
interface.launch(share=True)
|