Ilayda-j commited on
Commit
6a0434a
1 Parent(s): 361c9e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -16
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, state=None):
29
- if state is None:
30
- state = {}
31
-
32
- if 'step' not in state:
33
- state['step'] = 'get_text'
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
  )