Abdurahman
commited on
Commit
•
aab3ee4
1
Parent(s):
16f2d30
app
Browse files
app.py
CHANGED
@@ -66,16 +66,16 @@ with gr.Blocks() as app:
|
|
66 |
)
|
67 |
|
68 |
with gr.Group():
|
69 |
-
with gr.Row():
|
70 |
-
match_box = gr.Markdown(
|
71 |
-
label="Phonetic Match",
|
72 |
-
value="Matching and mismatched characters visualized here..."
|
73 |
-
)
|
74 |
with gr.Row():
|
75 |
score_box = gr.Textbox(
|
76 |
label="Phonetic Score",
|
77 |
placeholder="Your pronunciation score as a percentage..."
|
78 |
)
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
# Bind functions to buttons
|
81 |
generate_short_btn.click(
|
|
|
66 |
)
|
67 |
|
68 |
with gr.Group():
|
|
|
|
|
|
|
|
|
|
|
69 |
with gr.Row():
|
70 |
score_box = gr.Textbox(
|
71 |
label="Phonetic Score",
|
72 |
placeholder="Your pronunciation score as a percentage..."
|
73 |
)
|
74 |
+
with gr.Row():
|
75 |
+
match_box = gr.Markdown(
|
76 |
+
label="Phonetic Match",
|
77 |
+
value="Matching and mismatched characters visualized here..."
|
78 |
+
)
|
79 |
|
80 |
# Bind functions to buttons
|
81 |
generate_short_btn.click(
|
util.py
CHANGED
@@ -93,9 +93,9 @@ def calculate_pronunciation_accuracy(reference_text, output_text, language_code=
|
|
93 |
out_segment = output_ipa[j1:j2]
|
94 |
|
95 |
if opcode == 'equal': # Matching characters
|
96 |
-
comparison_md += f'<span style="color:
|
97 |
elif opcode in ['replace', 'delete', 'insert']: # Mismatched or missing
|
98 |
-
comparison_md += f'<span style="color:
|
99 |
|
100 |
comparison_md = f"<div>{comparison_md}</div>"
|
101 |
|
|
|
93 |
out_segment = output_ipa[j1:j2]
|
94 |
|
95 |
if opcode == 'equal': # Matching characters
|
96 |
+
comparison_md += f'<span style="color: blue;">{ref_segment}</span>'
|
97 |
elif opcode in ['replace', 'delete', 'insert']: # Mismatched or missing
|
98 |
+
comparison_md += f'<span style="color: black;">{ref_segment}</span>'
|
99 |
|
100 |
comparison_md = f"<div>{comparison_md}</div>"
|
101 |
|