poems_en / app.py
ismaelfaro's picture
update the space
1d84c12
raw
history blame
No virus
471 Bytes
import gradio as gr
from transformers import pipeline
pipe = pipeline("text-generation", model="ismaelfaro/gpt2-poems.en")
def poetchat(message, history):
text_generated = pipe(message)[0]['generated_text']
text_generated_cleaned = "\n".join(text_generated.replace("\\\\n","\\n").split('\\n'))
return text_generated_cleaned
title = "chat with a AIpoet"
app = gr.ChatInterface(poetchat, title=title, theme = 'Taithrah/Minimal')
app.queue().launch()