Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,9 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def update(
|
4 |
-
|
|
|
|
|
5 |
|
6 |
generator1 = gr.Interface.load("huggingface/gpt2-large")
|
7 |
generator2 = gr.Interface.load("huggingface/EleutherAI/gpt-neo-2.7B")
|
@@ -23,18 +25,21 @@ with demo:
|
|
23 |
# Hello World!
|
24 |
Start typing below to see the output.
|
25 |
""")
|
26 |
-
inp = gr.Textbox(placeholder="
|
|
|
|
|
|
|
27 |
out1 = gr.Textbox()
|
28 |
out2 = gr.Textbox()
|
29 |
out3 = gr.Textbox()
|
30 |
|
31 |
-
inp.change(fn=
|
32 |
-
inputs=inp,
|
33 |
outputs=out1)
|
34 |
-
inp.change(fn=f2,
|
35 |
-
|
36 |
-
|
37 |
-
inp.change(fn=f3,
|
38 |
-
|
39 |
-
|
40 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
def update(choice, text):
|
4 |
+
If choice==“gpt2large“:
|
5 |
+
return f1(text)
|
6 |
+
# return f"Welcome to Gradio, {name}!"
|
7 |
|
8 |
generator1 = gr.Interface.load("huggingface/gpt2-large")
|
9 |
generator2 = gr.Interface.load("huggingface/EleutherAI/gpt-neo-2.7B")
|
|
|
25 |
# Hello World!
|
26 |
Start typing below to see the output.
|
27 |
""")
|
28 |
+
inp = gr.Textbox(placeholder="Enter a statement to complete")
|
29 |
+
radio = gr.Radio(
|
30 |
+
["gpt2large", "gptNeo", "gpt6b"], label="What transformer model?"
|
31 |
+
)
|
32 |
out1 = gr.Textbox()
|
33 |
out2 = gr.Textbox()
|
34 |
out3 = gr.Textbox()
|
35 |
|
36 |
+
inp.change(fn=update,
|
37 |
+
inputs=inp, radio,
|
38 |
outputs=out1)
|
39 |
+
#inp.change(fn=f2,
|
40 |
+
# inputs=inp,
|
41 |
+
# outputs=out2)
|
42 |
+
#inp.change(fn=f3,
|
43 |
+
# inputs=inp,
|
44 |
+
# outputs=out3)
|
45 |
demo.launch()
|