Spaces:
Sleeping
Sleeping
Commit
·
8935be8
1
Parent(s):
263d107
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,21 +7,21 @@
|
|
| 7 |
#iface.launch()
|
| 8 |
|
| 9 |
|
| 10 |
-
import gradio as gr
|
| 11 |
|
| 12 |
-
key = ""
|
| 13 |
|
| 14 |
-
def get_key(k):
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
|
| 19 |
-
def greet(name):
|
| 20 |
-
|
| 21 |
|
| 22 |
-
iface = gr.Interface(fn=greet, inputs=["text", gr.inputs.Textbox()], outputs="text",
|
| 23 |
-
|
| 24 |
-
|
| 25 |
|
| 26 |
#iface.input[0].label = "Enter a key" # Set the label of the first input
|
| 27 |
#iface.input[1].label = "Enter a name"
|
|
@@ -35,4 +35,28 @@ iface = gr.Interface(fn=greet, inputs=["text", gr.inputs.Textbox()], outputs="te
|
|
| 35 |
#iface.buttons[1].type = "submit"
|
| 36 |
#iface.buttons[1].onclick_args = {"name": iface.inputs[1].value}
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
iface.launch()
|
|
|
|
| 7 |
#iface.launch()
|
| 8 |
|
| 9 |
|
| 10 |
+
#import gradio as gr
|
| 11 |
|
| 12 |
+
#key = ""
|
| 13 |
|
| 14 |
+
#def get_key(k):
|
| 15 |
+
# global key
|
| 16 |
+
## key = k
|
| 17 |
+
# return "Key saved successfully!"
|
| 18 |
|
| 19 |
+
#def greet(name):
|
| 20 |
+
# return "Hello " + name + "!!"
|
| 21 |
|
| 22 |
+
#iface = gr.Interface(fn=greet, inputs=["text", gr.inputs.Textbox()], outputs="text",
|
| 23 |
+
# inputs_layout="vertical", outputs_layout="vertical",
|
| 24 |
+
# title="Greeting App", description="Enter a key and a name to greet")
|
| 25 |
|
| 26 |
#iface.input[0].label = "Enter a key" # Set the label of the first input
|
| 27 |
#iface.input[1].label = "Enter a name"
|
|
|
|
| 35 |
#iface.buttons[1].type = "submit"
|
| 36 |
#iface.buttons[1].onclick_args = {"name": iface.inputs[1].value}
|
| 37 |
|
| 38 |
+
#iface.launch()
|
| 39 |
+
|
| 40 |
+
import gradio as gr
|
| 41 |
+
|
| 42 |
+
key = ""
|
| 43 |
+
|
| 44 |
+
def get_key(k):
|
| 45 |
+
global key
|
| 46 |
+
key = k
|
| 47 |
+
return "Key saved successfully!"
|
| 48 |
+
|
| 49 |
+
def greet(name):
|
| 50 |
+
return "Hello " + name + "!!"
|
| 51 |
+
|
| 52 |
+
key_input = gr.inputs.Textbox(label="Enter a key")
|
| 53 |
+
key_button = gr.Button(label="Save Key", type="submit", onclick=get_key)
|
| 54 |
+
|
| 55 |
+
name_input = gr.inputs.Textbox(label="Enter a name")
|
| 56 |
+
greet_button = gr.Button(label="Greet", type="submit", onclick_args={"name": name_input.value})
|
| 57 |
+
|
| 58 |
+
iface = gr.Interface(fn=greet, inputs=[key_input, name_input, key_button, greet_button], outputs="text",
|
| 59 |
+
inputs_layout="vertical", outputs_layout="vertical",
|
| 60 |
+
title="Greeting App", description="Enter a key and a name to greet")
|
| 61 |
+
|
| 62 |
iface.launch()
|