File size: 423 Bytes
c002e83
c7085c3
 
c002e83
c7085c3
 
 
 
 
9550e7f
c7085c3
bcf8f78
c7085c3
1
2
3
4
5
6
7
8
9
10
11
12
13
import gradio as gr
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text2text-generation", model="philipp-zettl/t5-small-long-qa")


def generate(context, question):
    prompt = f"question: {question} context: {context}"
    return pipe(prompt)[0]['generated_text']

demo = gr.Interface(fn=generate, inputs=[gr.Text('context'),gr.Text('question')], outputs="text")
demo.launch()