File size: 869 Bytes
2d7e907
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73932c7
 
2d7e907
 
 
 
 
 
 
 
 
 
73932c7
2d7e907
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
import gradio as gr
import transformers as tr
import numpy as np

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:
    textIn = gr.Textbox()
    textOut1 = gr.Textbox()
    
    bt1 = gr.Button("Re-run")
    textOut2 = gr.Textbox()
    textOut3 = gr.Textbox()

    b1 = gr.Button("gpt2-large")
    b2 = gr.Button("gpt-neo-2.7B")
    b3 = gr.Button("gpt-j-6B")

    b1.click(f1, inputs=textIn, outputs=textOut1 )
    b2.click(f2, inputs=textIn, outputs=textOut2 )
    b3.click(f3, inputs=textIn, outputs=textOut3 )
    bt1.click(f3, inputs=textOut1, outputs=textOut2 )
demo.launch()