Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -25,20 +25,12 @@ def generate_question_and_answer(text):
|
|
25 |
|
26 |
return question, answers
|
27 |
|
28 |
-
def get_feedback(text=None, user_answer=None, continue_quiz=None
|
29 |
-
if
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
if state['step'] == 'get_text':
|
36 |
-
if text:
|
37 |
-
state['question'], state['answers'] = generate_question_and_answer(text)
|
38 |
-
state['step'] = 'get_answer'
|
39 |
-
return f"Question: {state['question']}\nOptions:\n" + "\n".join(state['answers']), state
|
40 |
-
else:
|
41 |
-
return "Please input text to generate a question.", state
|
42 |
|
43 |
iface = gr.Interface(
|
44 |
fn=get_feedback,
|
@@ -48,8 +40,7 @@ iface = gr.Interface(
|
|
48 |
gr.inputs.Radio(choices=["Yes", "No"], label="Continue?")
|
49 |
],
|
50 |
outputs=[
|
51 |
-
gr.outputs.Textbox(label="Model Output")
|
52 |
-
gr.outputs.State(label="State")
|
53 |
],
|
54 |
live=True
|
55 |
)
|
|
|
25 |
|
26 |
return question, answers
|
27 |
|
28 |
+
def get_feedback(text=None, user_answer=None, continue_quiz=None):
|
29 |
+
if text:
|
30 |
+
question, answers = generate_question_and_answer(text)
|
31 |
+
return f"Question: {question}\nOptions:\n" + "\n".join(answers)
|
32 |
+
else:
|
33 |
+
return "Please input text to generate a question."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
iface = gr.Interface(
|
36 |
fn=get_feedback,
|
|
|
40 |
gr.inputs.Radio(choices=["Yes", "No"], label="Continue?")
|
41 |
],
|
42 |
outputs=[
|
43 |
+
gr.outputs.Textbox(label="Model Output")
|
|
|
44 |
],
|
45 |
live=True
|
46 |
)
|