awacke1 commited on
Commit
db16fb0
·
1 Parent(s): c771de6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -17
app.py CHANGED
@@ -2,28 +2,34 @@ import gradio as gr
2
  import transformers as tr
3
  import numpy as np
4
 
 
 
 
 
 
 
5
  demo = gr.Blocks()
6
 
7
  def f1(x):
8
- return x[::-1]
9
-
 
10
  def f3(x):
11
- return np.fliplr(x)
 
12
 
13
  with demo:
14
- gr.Markdown("Flip text or image files using this demo.")
15
- with gr.Tabs():
16
- with gr.TabItem("Flip Text"):
17
- text_input = gr.Textbox()
18
- text_output = gr.Textbox()
19
- text_button = gr.Button("Flip")
20
- with gr.TabItem("Flip Image"):
21
- with gr.Row():
22
- image_input = gr.Image()
23
- image_output = gr.Image()
24
- image_button = gr.Button("Flip")
25
-
26
- text_button.click(f1, inputs=text_input, outputs=text_output)
27
- image_button.click(f2, inputs=image_input, outputs=image_output)
28
 
29
  demo.launch()
 
2
  import transformers as tr
3
  import numpy as np
4
 
5
+
6
+ generator1 = gr.Interface.load("huggingface/gpt2-large")
7
+ generator2 = gr.Interface.load("huggingface/EleutherAI/gpt-neo-2.7B")
8
+ generator3 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
9
+
10
+
11
  demo = gr.Blocks()
12
 
13
  def f1(x):
14
+ return generator1(x)
15
+ def f2(x):
16
+ return generator2(x)
17
  def f3(x):
18
+ return generator3(x)
19
+
20
 
21
  with demo:
22
+ textIn = gr.Textbox()
23
+ textOut1 = gr.Textbox()
24
+ textOut2 = gr.Textbox()
25
+ textOut3 = gr.Textbox()
26
+
27
+ b1 = gr.Button("gpt2-large")
28
+ b2 = gr.Button("gpt-neo-2.7B")
29
+ b2 = gr.Button("gpt-j-6B")
30
+
31
+ b1.click(f1, inputs=textIn, outputs=textOut1 )
32
+ b2.click(f2, inputs=textIn, outputs=textOut2 )
33
+ b3.click(f3, inputs=textIn, outputs=textOut3 )
 
 
34
 
35
  demo.launch()