Spaces:
Sleeping
Sleeping
File size: 489 Bytes
6a5e75e 4b23361 6a5e75e 4b23361 6a5e75e 2ad506e 6a5e75e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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_generator3", 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()
|