XquanL commited on
Commit
e69a5e1
1 Parent(s): b51360a

Create new file

Browse files
Files changed (1) hide show
  1. text_gen.py +13 -0
text_gen.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ #define the model
5
+ model = pipeline("text-generation")
6
+
7
+ #define the predict function
8
+ def predict(prompt):
9
+ completion = model(prompt)[0]["generated_text"]
10
+ return completion
11
+
12
+ #define the gradio interface
13
+ gr.Interface(fn=predict, inputs="text", outputs="text").launch()