Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -37,7 +37,6 @@ questions = [
|
|
37 |
{"context": "Let's talk about the story 'Guide dogs'. Blind people can't see. But, they can still do things.", "question": "How can they do?", "label": "Transcription of how blind people do things", "answer": "They have guide dogs."},
|
38 |
{"context": "Guide dogs help blind people with everything. For example, they bring things for them. They help them. They open doors for them.", "question": "What else can they do for them?", "label": "Transcription of other abilities", "answer": "They can turn the TV on and off."}
|
39 |
]
|
40 |
-
|
41 |
current_question = 0
|
42 |
responses = []
|
43 |
|
@@ -66,11 +65,11 @@ def evaluate_responses():
|
|
66 |
result += f"<b>Q:</b> {question['question']}<br><b>Your Answer:</b> {user_response}<br><br>"
|
67 |
return result
|
68 |
|
69 |
-
def
|
70 |
global current_question, responses
|
71 |
current_question = 0
|
72 |
responses = []
|
73 |
-
return
|
74 |
|
75 |
with gr.Blocks() as demo:
|
76 |
gr.Markdown("### Interactive Questions")
|
@@ -88,7 +87,7 @@ with gr.Blocks() as demo:
|
|
88 |
demo.load(load_first_question, outputs=[question_audio, audio_input, transcription_output, btn_next, final_output, btn_restart])
|
89 |
|
90 |
btn_next.click(next_question, outputs=[question_audio, audio_input, transcription_output, btn_next, final_output, btn_restart])
|
|
|
91 |
audio_input.change(save_response, inputs=audio_input, outputs=transcription_output)
|
92 |
-
btn_restart.click(restart, outputs=[question_audio, audio_input, transcription_output, btn_next, final_output, btn_restart])
|
93 |
|
94 |
-
demo.launch()
|
|
|
37 |
{"context": "Let's talk about the story 'Guide dogs'. Blind people can't see. But, they can still do things.", "question": "How can they do?", "label": "Transcription of how blind people do things", "answer": "They have guide dogs."},
|
38 |
{"context": "Guide dogs help blind people with everything. For example, they bring things for them. They help them. They open doors for them.", "question": "What else can they do for them?", "label": "Transcription of other abilities", "answer": "They can turn the TV on and off."}
|
39 |
]
|
|
|
40 |
current_question = 0
|
41 |
responses = []
|
42 |
|
|
|
65 |
result += f"<b>Q:</b> {question['question']}<br><b>Your Answer:</b> {user_response}<br><br>"
|
66 |
return result
|
67 |
|
68 |
+
def reset():
|
69 |
global current_question, responses
|
70 |
current_question = 0
|
71 |
responses = []
|
72 |
+
return next_question()
|
73 |
|
74 |
with gr.Blocks() as demo:
|
75 |
gr.Markdown("### Interactive Questions")
|
|
|
87 |
demo.load(load_first_question, outputs=[question_audio, audio_input, transcription_output, btn_next, final_output, btn_restart])
|
88 |
|
89 |
btn_next.click(next_question, outputs=[question_audio, audio_input, transcription_output, btn_next, final_output, btn_restart])
|
90 |
+
btn_restart.click(reset, outputs=[question_audio, audio_input, transcription_output, btn_next, final_output, btn_restart])
|
91 |
audio_input.change(save_response, inputs=audio_input, outputs=transcription_output)
|
|
|
92 |
|
93 |
+
demo.launch()
|