File size: 570 Bytes
409a190
 
 
f492d76
5f43f70
409a190
 
f492d76
 
 
409a190
f492d76
409a190
f492d76
5f43f70
f492d76
409a190
 
f492d76
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from transformers import pipeline

# Correct pipeline task
question_generator = pipeline("text2text-generation", model="valhalla/t5-base-e2e-qg")

def generate_questions(text):
    inputs = f"generate questions: {text}"
    outputs = question_generator(inputs, max_length=256, do_sample=False)
    return outputs[0]["generated_text"]

iface = gr.Interface(
    fn=generate_questions,
    inputs=gr.Textbox(lines=10, label="Enter your paragraph"),
    outputs="text",
    title="πŸ” Generate Questions from Text"
)

iface.launch()