Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# now to create an interface with gradio
|
2 |
+
import gradio as gr
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
pipe = pipeline("text2text-generation", model="google/flan-t5-base")
|
6 |
+
|
7 |
+
# a function that uses the pipeline
|
8 |
+
# takes text as input and passes it to the pipeline
|
9 |
+
def chat(text):
|
10 |
+
output = pipe(text)[0]["generated_text"]
|
11 |
+
return output
|
12 |
+
# fucntion , input of type text , output of type text
|
13 |
+
demo = gr.Interface(chat , "text" , "text" )
|
14 |
+
demo.launch()
|