ruGPT3-Large / app.py
4eJIoBek's picture
Update app.py
b178d58
raw
history blame contribute delete
717 Bytes
import gradio as gr
from transformers import pipeline
generator = pipeline('text-generation', model='sberbank-ai/rugpt3large_based_on_gpt2')
def generate(text):
result = generator(text, max_length=200, temperature=0.7, num_return_sequences=1, do_sample=True)
return result[0]["generated_text"]
examples = [
["Александр Сергеевич Пушкин известен нам не только евгением онегиным, но и своими сказками, среди которых:"],
]
demo = gr.Interface(
fn=generate,
inputs = gr.inputs.Textbox(lines=3, label="Input Text"),
outputs=gr.outputs.Textbox(label="Generated Text"),
examples=examples
)
demo.launch()