Spaces:
Sleeping
Sleeping
sotirios-slv
commited on
Commit
•
04716fa
1
Parent(s):
34aef7d
Updated the script. Added some more labels and fomratted the score
Browse files
app.py
CHANGED
@@ -16,7 +16,8 @@ from transformers import (
|
|
16 |
|
17 |
diction_text = """
|
18 |
How is this leisure to be disposed of? In the public-house? the singing hall? the dancing-saloon?
|
19 |
-
which hold out seductions somewhat more dangerous, methinks, to honest
|
|
|
20 |
"""
|
21 |
|
22 |
diction_script = gr.Textbox(diction_text, interactive=False, show_label=False)
|
@@ -30,9 +31,10 @@ model_id = "openai/whisper-large-v3"
|
|
30 |
|
31 |
description = f"""
|
32 |
<div>
|
33 |
-
<p>Welcome to
|
34 |
-
<p>
|
35 |
-
<p>This app uses {model_id} to
|
|
|
36 |
</div>
|
37 |
"""
|
38 |
|
@@ -83,7 +85,9 @@ def transcribe_audio(diction_text, audio):
|
|
83 |
|
84 |
score = calc_score(diff_text)
|
85 |
|
86 |
-
|
|
|
|
|
87 |
|
88 |
|
89 |
highlighted_results = gr.HighlightedText(
|
@@ -93,7 +97,7 @@ highlighted_results = gr.HighlightedText(
|
|
93 |
color_map={"+": "red", "-": "green"},
|
94 |
)
|
95 |
|
96 |
-
score = gr.Textbox("0%")
|
97 |
|
98 |
|
99 |
input_audio = gr.Audio(
|
@@ -111,9 +115,8 @@ demo = gr.Interface(
|
|
111 |
fn=transcribe_audio,
|
112 |
inputs=[diction_script, input_audio],
|
113 |
outputs=[highlighted_results, score],
|
114 |
-
title="Redmond
|
115 |
description=description,
|
116 |
-
theme="abidlabs/Lime",
|
117 |
)
|
118 |
|
119 |
|
|
|
16 |
|
17 |
diction_text = """
|
18 |
How is this leisure to be disposed of? In the public-house? the singing hall? the dancing-saloon?
|
19 |
+
which hold out seductions somewhat more dangerous, methinks, to honest labour than those presented by a library...
|
20 |
+
We may well rejoice, then, when we see a room such as this filled with attentive and reflective readers.
|
21 |
"""
|
22 |
|
23 |
diction_script = gr.Textbox(diction_text, interactive=False, show_label=False)
|
|
|
31 |
|
32 |
description = f"""
|
33 |
<div>
|
34 |
+
<p>Welcome to Redmond Barry-oke! </p>
|
35 |
+
<p>This app aims to demonstrate the potential of using machine learning to transcribe audio. Users are invited to record themselves reading a brief and abridged excerpt from a speech delivered by Sir Redmond Barry at the opening of The Free Public Library of Ballarat Est in 1869. Once recorded and submitted the app will transcribe and return a "diction" score.</p>
|
36 |
+
<p>This app uses {model_id} to perform automated transcription</p>
|
37 |
+
<p>A full transcript of Sir Redmond Barry's speech can be read in the <a href="https://latrobejournal.slv.vic.gov.au/latrobejournal/issue/latrobe-26/t1-g-t3.html" target="_blank">La Trobe Journal</a></p>
|
38 |
</div>
|
39 |
"""
|
40 |
|
|
|
85 |
|
86 |
score = calc_score(diff_text)
|
87 |
|
88 |
+
formatted_score = f"{str(round(score,3))}%"
|
89 |
+
|
90 |
+
return diff_text, formatted_score
|
91 |
|
92 |
|
93 |
highlighted_results = gr.HighlightedText(
|
|
|
97 |
color_map={"+": "red", "-": "green"},
|
98 |
)
|
99 |
|
100 |
+
score = gr.Textbox("0%", label="Score")
|
101 |
|
102 |
|
103 |
input_audio = gr.Audio(
|
|
|
115 |
fn=transcribe_audio,
|
116 |
inputs=[diction_script, input_audio],
|
117 |
outputs=[highlighted_results, score],
|
118 |
+
title="Redmond Barry-oke",
|
119 |
description=description,
|
|
|
120 |
)
|
121 |
|
122 |
|