ismaelfaro commited on
Commit
1d84c12
1 Parent(s): 9275cd5

update the space

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ from transformers import pipeline
4
+
5
+ pipe = pipeline("text-generation", model="ismaelfaro/gpt2-poems.en")
6
+
7
+ def poetchat(message, history):
8
+ text_generated = pipe(message)[0]['generated_text']
9
+ text_generated_cleaned = "\n".join(text_generated.replace("\\\\n","\\n").split('\\n'))
10
+ return text_generated_cleaned
11
+
12
+ title = "chat with a AIpoet"
13
+
14
+ app = gr.ChatInterface(poetchat, title=title, theme = 'Taithrah/Minimal')
15
+
16
+
17
+ app.queue().launch()
18
+
19
+