Spaces:
Runtime error
Runtime error
Adding speech to difficulty score
Browse files
app.py
CHANGED
@@ -396,7 +396,10 @@ def get_dif_inter(text):
|
|
396 |
def speech_to_text(speech, target):
|
397 |
text = p(speech)["text"]
|
398 |
return text.lower(), {'Pronunciation Score': compute_score(text, target) / 100}, phon(target)
|
399 |
-
|
|
|
|
|
|
|
400 |
|
401 |
def my_i_func(text):
|
402 |
return {"original": "", "interpretation": [('', 0.0), ('what', -0.2), ('great', 0.3), ('day', 0.5), ('', 0.0)]}
|
@@ -448,7 +451,7 @@ with gr.Blocks() as demo:
|
|
448 |
grade.click(diversity_inter, inputs=in_text, outputs=interpretation)
|
449 |
grade.click(get_dif_inter, inputs=in_text, outputs=interpretation2)
|
450 |
grade.click(get_plot, inputs=in_text, outputs=plotter)
|
451 |
-
|
452 |
-
|
453 |
b1.click(speech_to_text, inputs=[audio_file1, target], outputs=[text, some_val, phones])
|
454 |
demo.launch(debug=True)
|
|
|
396 |
def speech_to_text(speech, target):
|
397 |
text = p(speech)["text"]
|
398 |
return text.lower(), {'Pronunciation Score': compute_score(text, target) / 100}, phon(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)]}
|
|
|
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)
|