Spaces:
Sleeping
Sleeping
from transformers import pipeline | |
import gradio as gr | |
def generate_text(prompt): | |
# load the model | |
generator = pipeline('text-generation', model='maiurilorenzo/dante-gpt') | |
result = generator(prompt, max_length=100, num_return_sequences=1) | |
return result[0]['generated_text'] | |
demo = gr.Interface(fn=generate_text, inputs="text", outputs="text", title="Italian poetry generator in the style of Dante") | |
demo = gr.Interface( | |
fn=generate_text, | |
inputs="text", | |
outputs="text", | |
title="Italian poetry generator in the style of Dante", | |
description="Start with a prompt such as 'Nel mezzo del cammin di nostra vita,' and find out what Dante could say if he was alive in our epoch!", | |
article="The project is based on GPT-2 and is still in early development, different prompts can produce different outputs and errors are to be expected" | |
) | |
demo.launch() | |