Spaces:
Runtime error
Runtime error
Adding transcription for speech to score
Browse files
app.py
CHANGED
|
@@ -399,7 +399,7 @@ def speech_to_text(speech, target):
|
|
| 399 |
|
| 400 |
def speech_to_score(speech):
|
| 401 |
text = p(speech)["text"]
|
| 402 |
-
return reading_difficulty(text)
|
| 403 |
|
| 404 |
def my_i_func(text):
|
| 405 |
return {"original": "", "interpretation": [('', 0.0), ('what', -0.2), ('great', 0.3), ('day', 0.5), ('', 0.0)]}
|
|
@@ -419,6 +419,7 @@ with gr.Blocks() as demo:
|
|
| 419 |
grade = gr.Button("Grade Your Text")
|
| 420 |
with gr.TabItem("Speech"):
|
| 421 |
audio_file = gr.Audio(source="microphone", type="filepath")
|
|
|
|
| 422 |
grade1 = gr.Button("Grade Your Speech")
|
| 423 |
|
| 424 |
with gr.Box():
|
|
@@ -451,7 +452,8 @@ with gr.Blocks() as demo:
|
|
| 451 |
grade.click(diversity_inter, inputs=in_text, outputs=interpretation)
|
| 452 |
grade.click(get_dif_inter, inputs=in_text, outputs=interpretation2)
|
| 453 |
grade.click(get_plot, inputs=in_text, outputs=plotter)
|
| 454 |
-
grade1.click(speech_to_score, inputs=audio_file, outputs=diff_output)
|
|
|
|
| 455 |
|
| 456 |
b1.click(speech_to_text, inputs=[audio_file1, target], outputs=[text, some_val, phones])
|
| 457 |
demo.launch(debug=True)
|
|
|
|
| 399 |
|
| 400 |
def speech_to_score(speech):
|
| 401 |
text = p(speech)["text"]
|
| 402 |
+
return reading_difficulty(text), text
|
| 403 |
|
| 404 |
def my_i_func(text):
|
| 405 |
return {"original": "", "interpretation": [('', 0.0), ('what', -0.2), ('great', 0.3), ('day', 0.5), ('', 0.0)]}
|
|
|
|
| 419 |
grade = gr.Button("Grade Your Text")
|
| 420 |
with gr.TabItem("Speech"):
|
| 421 |
audio_file = gr.Audio(source="microphone", type="filepath")
|
| 422 |
+
audio_trans = gr.Textbox(label="Transcription")
|
| 423 |
grade1 = gr.Button("Grade Your Speech")
|
| 424 |
|
| 425 |
with gr.Box():
|
|
|
|
| 452 |
grade.click(diversity_inter, inputs=in_text, outputs=interpretation)
|
| 453 |
grade.click(get_dif_inter, inputs=in_text, outputs=interpretation2)
|
| 454 |
grade.click(get_plot, inputs=in_text, outputs=plotter)
|
| 455 |
+
grade1.click(speech_to_score, inputs=audio_file, outputs=[diff_output, audio_trans])
|
| 456 |
+
|
| 457 |
|
| 458 |
b1.click(speech_to_text, inputs=[audio_file1, target], outputs=[text, some_val, phones])
|
| 459 |
demo.launch(debug=True)
|