aiqcamp commited on
Commit
92535df
·
verified ·
1 Parent(s): 08dd9e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -24
app.py CHANGED
@@ -148,14 +148,7 @@ def create_detailed_feedback(transcription, grammar_score, corrected_text,
148
 
149
  def process_audio(audio):
150
  if audio is None:
151
- return {
152
- "transcription": "No audio provided.",
153
- "grammar_score": "",
154
- "corrected": "",
155
- "feedback": "",
156
- "metrics_chart": None,
157
- "detailed_analysis": ""
158
- }
159
 
160
  start_time = time.time()
161
 
@@ -272,14 +265,7 @@ def process_audio(audio):
272
  {', '.join([f"{k}: {v}" for k, v in sorted(pos_counts.items(), key=lambda x: x[1], reverse=True)[:5]])}
273
  """
274
 
275
- return {
276
- "transcription": transcription,
277
- "grammar_score": grammar_score,
278
- "corrected": corrected,
279
- "feedback": feedback,
280
- "metrics_chart": fig,
281
- "detailed_analysis": detailed_analysis
282
- }
283
 
284
  # Create theme
285
  theme = gr.themes.Soft(
@@ -358,14 +344,14 @@ with gr.Blocks(theme=theme, css="""
358
  submit_btn.click(
359
  fn=process_audio,
360
  inputs=[audio_input],
361
- outputs={
362
- "transcription": transcription_output,
363
- "grammar_score": grammar_score_output,
364
- "corrected": corrected_output,
365
- "feedback": feedback_output,
366
- "metrics_chart": metrics_chart,
367
- "detailed_analysis": detailed_analysis
368
- }
369
  )
370
 
371
  if __name__ == "__main__":
 
148
 
149
  def process_audio(audio):
150
  if audio is None:
151
+ return "No audio provided.", "", "", "", None, ""
 
 
 
 
 
 
 
152
 
153
  start_time = time.time()
154
 
 
265
  {', '.join([f"{k}: {v}" for k, v in sorted(pos_counts.items(), key=lambda x: x[1], reverse=True)[:5]])}
266
  """
267
 
268
+ return transcription, grammar_score, corrected, feedback, fig, detailed_analysis
 
 
 
 
 
 
 
269
 
270
  # Create theme
271
  theme = gr.themes.Soft(
 
344
  submit_btn.click(
345
  fn=process_audio,
346
  inputs=[audio_input],
347
+ outputs=[
348
+ transcription_output,
349
+ grammar_score_output,
350
+ corrected_output,
351
+ feedback_output,
352
+ metrics_chart,
353
+ detailed_analysis
354
+ ]
355
  )
356
 
357
  if __name__ == "__main__":