File size: 908 Bytes
8fe01ad
 
 
 
7dc0cf4
 
 
 
 
8fe01ad
 
 
7dc0cf4
 
 
 
 
 
 
8fe01ad
 
 
 
 
 
 
7dc0cf4
 
 
8fe01ad
 
 
7dc0cf4
 
 
 
 
 
 
8fe01ad
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
35
36
37
38
39
40
import gradio as gr

def update(name):
    return f"Welcome to Gradio, {name}!"
    
generator1 = gr.Interface.load("huggingface/gpt2-large")
generator2 = gr.Interface.load("huggingface/EleutherAI/gpt-neo-2.7B")
generator3 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")


demo = gr.Blocks()

def f1(x):
    return generator1(x)
def f2(x):
    return generator2(x)
def f3(x):
    return generator3(x)

with demo:
    gr.Markdown(
    """
    # Hello World!
    Start typing below to see the output.
    """)
    inp = gr.Textbox(placeholder="What is your name?")
    out1 = gr.Textbox()
    out2 = gr.Textbox()
    out3 = gr.Textbox()

    inp.change(fn=update, 
               inputs=inp, 
               outputs=out1)
    inp.change(fn=update, 
               inputs=inp, 
               outputs=out2)
    inp.change(fn=update, 
               inputs=inp, 
               outputs=out3)
demo.launch()