Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
generator = pipeline('text-generation', model='Den4ikAI/rugpt3_2ch')
|
5 |
+
|
6 |
+
def generate(text):
|
7 |
+
result = generator(text, max_length=275, temperature=0.7, num_return_sequences=1, do_sample=True)
|
8 |
+
return result[0]["generated_text"]
|
9 |
+
|
10 |
+
examples = [
|
11 |
+
["Александр Сергеевич Пушкин известен нам не только евгением онегиным, но и своими сказками, среди которых:"],
|
12 |
+
]
|
13 |
+
|
14 |
+
demo = gr.Interface(
|
15 |
+
fn=generate,
|
16 |
+
inputs = gr.inputs.Textbox(lines=3, label="Input Text"),
|
17 |
+
outputs=gr.outputs.Textbox(label="Generated Text"),
|
18 |
+
examples=examples
|
19 |
+
)
|
20 |
+
|
21 |
+
demo.launch()
|