mramirez2001 commited on
Commit
d96d685
verified
1 Parent(s): 50ef0bd

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -3
app.py CHANGED
@@ -166,10 +166,28 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
166
  outputs=[audio_in_chat]
167
  )
168
 
169
- # --- PESTA脩A 2: EVALUACI脫N POR FRASE (sin cambios) ---
170
  with gr.TabItem("Evaluaci贸n por Frase"):
171
- # ... (todo el c贸digo de la interfaz de la pesta帽a 2 se mantiene igual)
172
- pass
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
 
174
  if __name__ == "__main__":
175
  if not api_key_found: print("\nFATAL: OpenAI API key not found.")
 
166
  outputs=[audio_in_chat]
167
  )
168
 
169
+ # --- PESTA脩A 2: EVALUACI脫N POR FRASE ---
170
  with gr.TabItem("Evaluaci贸n por Frase"):
171
+ TONGUE_TWISTERS = ["Peter Piper picked a peck of pickled peppers.", "She sells seashells by the seashore.", "How much wood would a woodchuck chuck if a woodchuck could chuck wood?", "Betty Botter bought some butter but she said the butter鈥檚 bitter.", "A proper copper coffee pot."]
172
+ gr.Markdown("Choose a tongue twister or write your own sentence. Record yourself, and our AI examiner will provide a detailed diagnostic report.")
173
+ tongue_twister_selector = gr.Dropdown(choices=TONGUE_TWISTERS, label="Or Choose a Tongue Twister to Practice")
174
+ with gr.Row():
175
+ with gr.Column(scale=1):
176
+ audio_in_sentence = gr.Audio(sources=["microphone"], type="numpy", label="1. Record Your Voice")
177
+ text_in_sentence = gr.Textbox(lines=3, label="2. Reference Sentence", value=TONGUE_TWISTERS[0])
178
+ submit_btn_sentence = gr.Button("Get Assessment", variant="primary")
179
+ with gr.Column(scale=2):
180
+ gr.Markdown("### Assessment Summary")
181
+ with gr.Row():
182
+ score_out_sentence = gr.Number(label="Overall Score (0-100)", interactive=False)
183
+ level_out_sentence = gr.Textbox(label="Estimated CEFR Level", interactive=False)
184
+ holistic_feedback_out_sentence = gr.Markdown(label="Examiner's Feedback")
185
+ gr.Markdown("--- \n ### Detailed Word-by-Word Analysis")
186
+ word_analysis_out_sentence = gr.Markdown(label="Phonetic Breakdown")
187
+ def update_text(choice): return gr.Textbox(value=choice)
188
+ tongue_twister_selector.change(fn=update_text, inputs=tongue_twister_selector, outputs=text_in_sentence)
189
+ submit_btn_sentence.click(fn=run_sentence_evaluation, inputs=[audio_in_sentence, text_in_sentence], outputs=[score_out_sentence, level_out_sentence, holistic_feedback_out_sentence, word_analysis_out_sentence])
190
+
191
 
192
  if __name__ == "__main__":
193
  if not api_key_found: print("\nFATAL: OpenAI API key not found.")