Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
from backend import get_question
|
3 |
|
4 |
-
def generate(context, qtype, difficulty, num, use_beam_search, num_beams):
|
|
|
5 |
try:
|
6 |
-
return "\n\n".join(get_question(qtype, difficulty, context, "", num, use_beam_search=use_beam_search, num_beams=num_beams))
|
|
|
7 |
except Exception as e:
|
8 |
return f"Error: {str(e)}"
|
9 |
|
@@ -18,23 +20,22 @@ with gr.Blocks() as demo:
|
|
18 |
difficulty = gr.Dropdown(["easy", "medium", "hard"], label="Difficulty")
|
19 |
num = gr.Slider(1, 5, step=1, label="Number of Questions", value=1)
|
20 |
|
21 |
-
# with gr.Row(visible=True) as beam_controls
|
22 |
# use_beam = gr.Checkbox(label="Use Beam Search", value=False)
|
23 |
# beam_dropdown = gr.Dropdown(choices=[3, 4, 5, 6], value=3, label="Number of Beams")
|
24 |
|
25 |
# def toggle_beam_controls(n):
|
26 |
# return gr.update(visible=(n == 1))
|
27 |
|
28 |
-
# num.change(fn=toggle_beam_controls, inputs=num, outputs=beam_controls)
|
29 |
-
use_beam = False
|
30 |
-
beam_dropdown = 1
|
31 |
|
32 |
with gr.Row():
|
33 |
btn = gr.Button("Generate Questions")
|
34 |
|
35 |
output = gr.Textbox(label="Generated Questions", lines=10)
|
36 |
|
37 |
-
btn.click(fn=generate, inputs=[context, qtype, difficulty, num, use_beam, beam_dropdown], outputs=output)
|
|
|
38 |
|
39 |
if __name__ == "__main__":
|
40 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from backend import get_question
|
3 |
|
4 |
+
# def generate(context, qtype, difficulty, num, use_beam_search, num_beams): -----------------------
|
5 |
+
def generate(context, qtype, difficulty, num):
|
6 |
try:
|
7 |
+
# return "\n\n".join(get_question(qtype, difficulty, context, "", num, use_beam_search=use_beam_search, num_beams=num_beams)) -------------
|
8 |
+
return "\n\n".join(get_question(qtype, difficulty, context, "", num))
|
9 |
except Exception as e:
|
10 |
return f"Error: {str(e)}"
|
11 |
|
|
|
20 |
difficulty = gr.Dropdown(["easy", "medium", "hard"], label="Difficulty")
|
21 |
num = gr.Slider(1, 5, step=1, label="Number of Questions", value=1)
|
22 |
|
23 |
+
# with gr.Row(visible=True) as beam_controls:--------------------------------------
|
24 |
# use_beam = gr.Checkbox(label="Use Beam Search", value=False)
|
25 |
# beam_dropdown = gr.Dropdown(choices=[3, 4, 5, 6], value=3, label="Number of Beams")
|
26 |
|
27 |
# def toggle_beam_controls(n):
|
28 |
# return gr.update(visible=(n == 1))
|
29 |
|
30 |
+
# num.change(fn=toggle_beam_controls, inputs=num, outputs=beam_controls) -------------------------------
|
|
|
|
|
31 |
|
32 |
with gr.Row():
|
33 |
btn = gr.Button("Generate Questions")
|
34 |
|
35 |
output = gr.Textbox(label="Generated Questions", lines=10)
|
36 |
|
37 |
+
# btn.click(fn=generate, inputs=[context, qtype, difficulty, num, use_beam, beam_dropdown], outputs=output)
|
38 |
+
btn.click(fn=generate, inputs=[context, qtype, difficulty, num], outputs=output)
|
39 |
|
40 |
if __name__ == "__main__":
|
41 |
demo.launch()
|