jmcob commited on
Commit
14deb06
1 Parent(s): 5dff0ad

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -0
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import transformers as tr
3
+ import numpy as np
4
+
5
+ generator1 = gr.Interface.load("huggingface/gpt2-large")
6
+ generator2 = gr.Interface.load("huggingface/EleutherAI/gpt-neo-2.7B")
7
+ generator3 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
8
+
9
+
10
+ demo = gr.Blocks()
11
+
12
+ def f1(x):
13
+ return generator1(x)
14
+ def f2(x):
15
+ return generator2(x)
16
+ def f3(x):
17
+ return generator3(x)
18
+
19
+
20
+ with demo:
21
+ textIn = gr.Textbox()
22
+ textOut1 = gr.Textbox()
23
+ textOut2 = gr.Textbox()
24
+ textOut3 = gr.Textbox()
25
+
26
+ b1 = gr.Button("gpt2-large")
27
+ b2 = gr.Button("gpt-neo-2.7B")
28
+ b3 = gr.Button("gpt-j-6B")
29
+
30
+ b1.click(f1, inputs=textIn, outputs=textOut1 )
31
+ b2.click(f2, inputs=textIn, outputs=textOut2 )
32
+ b3.click(f3, inputs=textIn, outputs=textOut3 )
33
+
34
+ demo.launch()