Spaces:
Sleeping
Sleeping
Commit
·
106dd33
1
Parent(s):
ca6c9ce
Update app.py
Browse files
app.py
CHANGED
@@ -59,6 +59,7 @@ def generate_qa(context, recommended_word, temperature, top_p, num_samples=3):
|
|
59 |
generated_text = tokenizer.batch_decode(output, skip_special_tokens=True)
|
60 |
return generated_text
|
61 |
|
|
|
62 |
# Create the Gradio interface with sliders for temperature and top-p
|
63 |
iface = gr.Interface(
|
64 |
fn=generate_qa,
|
@@ -66,13 +67,12 @@ iface = gr.Interface(
|
|
66 |
"text",
|
67 |
gr.inputs.Radio(recommended_words, label="Choose a Recommended Word"),
|
68 |
gr.inputs.Slider(minimum=0.2, maximum=2, default=1, step=0.1, label="Temperature"),
|
69 |
-
gr.inputs.Slider(minimum=0.1, maximum=1, default=0.8, step=0.1, label="Top-p")
|
70 |
-
gr.inputs.Number(default=3, label="Number of Samples")
|
71 |
],
|
72 |
-
outputs=
|
73 |
title="Question Generation and Answering",
|
74 |
-
description="Enter a context, choose a recommended word, adjust temperature and top-p
|
75 |
)
|
76 |
|
77 |
# Launch the interface
|
78 |
-
iface.launch()
|
|
|
59 |
generated_text = tokenizer.batch_decode(output, skip_special_tokens=True)
|
60 |
return generated_text
|
61 |
|
62 |
+
# Create the Gradio interface with sliders for temperature and top-p
|
63 |
# Create the Gradio interface with sliders for temperature and top-p
|
64 |
iface = gr.Interface(
|
65 |
fn=generate_qa,
|
|
|
67 |
"text",
|
68 |
gr.inputs.Radio(recommended_words, label="Choose a Recommended Word"),
|
69 |
gr.inputs.Slider(minimum=0.2, maximum=2, default=1, step=0.1, label="Temperature"),
|
70 |
+
gr.inputs.Slider(minimum=0.1, maximum=1, default=0.8, step=0.1, label="Top-p")
|
|
|
71 |
],
|
72 |
+
outputs="text",
|
73 |
title="Question Generation and Answering",
|
74 |
+
description="Enter a context, choose a recommended word, and adjust temperature and top-p. The model will generate a question and answer.",
|
75 |
)
|
76 |
|
77 |
# Launch the interface
|
78 |
+
iface.launch()
|