Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,9 @@ import gradio as gr
|
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
def load_question_generator():
|
| 6 |
-
pipe = pipeline("text2text-generation", model="SinaRp/Question_generator_persian"
|
|
|
|
|
|
|
| 7 |
return pipe
|
| 8 |
|
| 9 |
def generate_questions(context, num_questions):
|
|
@@ -18,7 +20,7 @@ iface = gr.Interface(
|
|
| 18 |
fn=generate_questions,
|
| 19 |
inputs=[
|
| 20 |
gr.Textbox(lines=5, label="Enter your text context"),
|
| 21 |
-
gr.Slider(minimum=1, maximum=5,
|
| 22 |
],
|
| 23 |
outputs=gr.Textbox(label="Generated Questions"),
|
| 24 |
title="Question Generator",
|
|
|
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
def load_question_generator():
|
| 6 |
+
pipe = pipeline("text2text-generation", model="SinaRp/Question_generator_persian", do_sample=True,
|
| 7 |
+
top_k=50,
|
| 8 |
+
top_p=0.95)
|
| 9 |
return pipe
|
| 10 |
|
| 11 |
def generate_questions(context, num_questions):
|
|
|
|
| 20 |
fn=generate_questions,
|
| 21 |
inputs=[
|
| 22 |
gr.Textbox(lines=5, label="Enter your text context"),
|
| 23 |
+
gr.Slider(minimum=1, maximum=5, step=1, label="Number of questions")
|
| 24 |
],
|
| 25 |
outputs=gr.Textbox(label="Generated Questions"),
|
| 26 |
title="Question Generator",
|