File size: 798 Bytes
8ff16c1
 
 
66be9ee
8ff16c1
 
 
 
 
 
 
 
 
c0ad07a
 
8ff16c1
c0ad07a
8ff16c1
c0ad07a
 
 
8ff16c1
c0ad07a
 
8ff16c1
 
c0ad07a
416b67b
 
c0ad07a
8ff16c1
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import numpy as np
import torch
import gradio as gr
from gradio import mix

def set_seed(args):
    rd = np.random.randint(100000)
    print('seed =', rd)
    np.random.seed(rd)
    torch.manual_seed(rd)
    if args.n_gpu > 0:
        torch.cuda.manual_seed_all(rd)

title = "ruGPT3 Song Writer"
description = "Generate russian songs via fine-tuned ruGPT3"

io = gr.Interface.load("models/bankholdup/rugpt3_song_writer")

examples = [
    ['Как дела? Как дела? Это новый кадиллак']
]

def inference(text):
    return io(text)

gr.Interface(
    inference, 
    [gr.inputs.Textbox(label="Input text")],
    gr.outputs.Textbox(label="Output text"),
    examples=examples,
    title=title,
    description=description,
    ).launch(enable_queue=True,cache_examples=True)