philipp-zettl's picture
Update app.py
9550e7f verified
raw
history blame contribute delete
423 Bytes
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()