RobPruzan commited on
Commit
8544754
1 Parent(s): 88577eb

Adding speech to difficulty score

Browse files
Files changed (1) hide show
  1. app.py +6 -3
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
- # grade1.click(transcribe, inputs=input_audio, outputs=in_text)
452
- # pronun.click(transcribe, inputs=pronon_audio, outputs=trans)
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)