Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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
|
| 9 |
-
|
|
|
|
| 10 |
def f3(x):
|
| 11 |
-
return
|
|
|
|
| 12 |
|
| 13 |
with demo:
|
| 14 |
-
gr.
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 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()
|