not-lain commited on
Commit
6e1f430
1 Parent(s): 179e9e1

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
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()