Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,13 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
# Use a pipeline as a high-level helper
|
3 |
+
from transformers import pipeline
|
4 |
|
5 |
+
pipe = pipeline("text2text-generation", model="philipp-zettl/t5-small-long-qa")
|
6 |
+
|
7 |
+
|
8 |
+
def generate(context, question):
|
9 |
+
prompt = f"question: {question} context: {context}"
|
10 |
+
return pipe(prompt)
|
11 |
+
|
12 |
+
demo = gr.Interface(fn=greet, inputs=[gr.Text('context'),gr.Text('question')], outputs="text")
|
13 |
+
demo.launch()
|