VerseCraft / app.py
marufc36
app.py
4b23361
raw
history blame
489 Bytes
import gradio as gr
import torch
from transformers import pipeline
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
pipe = pipeline("text-generation", model="poem_generator2", device=device)
def generate_poem(text):
res = pipe(text)[0]["generated_text"]
return res
iface = gr.Interface(
generate_poem,
gr.Textbox(lines=5, label="Enter text to start the Poetic Lines"),
gr.Textbox(label="Generated Poetic Lines")
)
iface.launch()