Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -415,14 +415,7 @@ def compare_pronunciation(audio, language_choice, intended_sentence):
|
|
415 |
|
416 |
# ---------------- UI ---------------- #
|
417 |
def create_interface():
|
418 |
-
with gr.Blocks(
|
419 |
-
title="ποΈ Multilingual Pronunciation Trainer",
|
420 |
-
theme=gr.themes.Soft(),
|
421 |
-
css="""
|
422 |
-
.gradio-container {max-width: 1200px !important}
|
423 |
-
.feedback-box {font-size: 18px !important; font-weight: bold !important}
|
424 |
-
"""
|
425 |
-
) as demo:
|
426 |
|
427 |
gr.Markdown("""
|
428 |
# ποΈ Multilingual Pronunciation Trainer
|
@@ -447,34 +440,30 @@ def create_interface():
|
|
447 |
lang_choice = gr.Dropdown(
|
448 |
choices=list(LANG_CODES.keys()),
|
449 |
value="Tamil",
|
450 |
-
label="π Select Language"
|
451 |
-
info="Choose the language you want to practice"
|
452 |
)
|
453 |
with gr.Column(scale=1):
|
454 |
-
gen_btn = gr.Button("π² Generate Sentence", variant="primary"
|
455 |
|
456 |
intended_display = gr.Textbox(
|
457 |
label="π Practice Sentence (Read this aloud)",
|
458 |
placeholder="Click 'Generate Sentence' to get started...",
|
459 |
interactive=False,
|
460 |
-
lines=3
|
461 |
-
show_copy_button=True
|
462 |
)
|
463 |
|
464 |
audio_input = gr.Audio(
|
465 |
sources=["microphone", "upload"],
|
466 |
type="filepath",
|
467 |
-
label="π€ Record Your Pronunciation"
|
468 |
-
info="Record yourself reading the sentence above"
|
469 |
)
|
470 |
|
471 |
-
analyze_btn = gr.Button("π Analyze Pronunciation", variant="primary"
|
472 |
|
473 |
status_output = gr.Textbox(
|
474 |
label="π Analysis Results",
|
475 |
interactive=False,
|
476 |
-
lines=3
|
477 |
-
elem_classes=["feedback-box"]
|
478 |
)
|
479 |
|
480 |
with gr.Row():
|
@@ -486,28 +475,23 @@ def create_interface():
|
|
486 |
)
|
487 |
wer_out = gr.Textbox(
|
488 |
label="π Word Accuracy",
|
489 |
-
interactive=False
|
490 |
-
info="Higher percentage = better pronunciation"
|
491 |
)
|
492 |
|
493 |
with gr.Column():
|
494 |
pass2_out = gr.Textbox(
|
495 |
label="π§ Target-Biased Analysis",
|
496 |
interactive=False,
|
497 |
-
lines=2
|
498 |
-
info="What the model thinks you meant to say"
|
499 |
)
|
500 |
cer_out = gr.Textbox(
|
501 |
label="π Character Accuracy",
|
502 |
-
interactive=False
|
503 |
-
info="Character-level pronunciation accuracy"
|
504 |
)
|
505 |
|
506 |
hk_out = gr.Textbox(
|
507 |
label="π€ Romanization (Harvard-Kyoto)",
|
508 |
-
interactive=False
|
509 |
-
info="Romanized version for easier analysis",
|
510 |
-
show_copy_button=True
|
511 |
)
|
512 |
|
513 |
with gr.Accordion("π Detailed Visual Feedback", open=True):
|
@@ -597,7 +581,5 @@ if __name__ == "__main__":
|
|
597 |
share=True,
|
598 |
show_error=True,
|
599 |
server_name="0.0.0.0",
|
600 |
-
server_port=7860
|
601 |
-
show_tips=True,
|
602 |
-
enable_queue=True
|
603 |
)
|
|
|
415 |
|
416 |
# ---------------- UI ---------------- #
|
417 |
def create_interface():
|
418 |
+
with gr.Blocks(title="ποΈ Multilingual Pronunciation Trainer") as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
419 |
|
420 |
gr.Markdown("""
|
421 |
# ποΈ Multilingual Pronunciation Trainer
|
|
|
440 |
lang_choice = gr.Dropdown(
|
441 |
choices=list(LANG_CODES.keys()),
|
442 |
value="Tamil",
|
443 |
+
label="π Select Language"
|
|
|
444 |
)
|
445 |
with gr.Column(scale=1):
|
446 |
+
gen_btn = gr.Button("π² Generate Sentence", variant="primary")
|
447 |
|
448 |
intended_display = gr.Textbox(
|
449 |
label="π Practice Sentence (Read this aloud)",
|
450 |
placeholder="Click 'Generate Sentence' to get started...",
|
451 |
interactive=False,
|
452 |
+
lines=3
|
|
|
453 |
)
|
454 |
|
455 |
audio_input = gr.Audio(
|
456 |
sources=["microphone", "upload"],
|
457 |
type="filepath",
|
458 |
+
label="π€ Record Your Pronunciation"
|
|
|
459 |
)
|
460 |
|
461 |
+
analyze_btn = gr.Button("π Analyze Pronunciation", variant="primary")
|
462 |
|
463 |
status_output = gr.Textbox(
|
464 |
label="π Analysis Results",
|
465 |
interactive=False,
|
466 |
+
lines=3
|
|
|
467 |
)
|
468 |
|
469 |
with gr.Row():
|
|
|
475 |
)
|
476 |
wer_out = gr.Textbox(
|
477 |
label="π Word Accuracy",
|
478 |
+
interactive=False
|
|
|
479 |
)
|
480 |
|
481 |
with gr.Column():
|
482 |
pass2_out = gr.Textbox(
|
483 |
label="π§ Target-Biased Analysis",
|
484 |
interactive=False,
|
485 |
+
lines=2
|
|
|
486 |
)
|
487 |
cer_out = gr.Textbox(
|
488 |
label="π Character Accuracy",
|
489 |
+
interactive=False
|
|
|
490 |
)
|
491 |
|
492 |
hk_out = gr.Textbox(
|
493 |
label="π€ Romanization (Harvard-Kyoto)",
|
494 |
+
interactive=False
|
|
|
|
|
495 |
)
|
496 |
|
497 |
with gr.Accordion("π Detailed Visual Feedback", open=True):
|
|
|
581 |
share=True,
|
582 |
show_error=True,
|
583 |
server_name="0.0.0.0",
|
584 |
+
server_port=7860
|
|
|
|
|
585 |
)
|