Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,53 +1,36 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
return one
|
| 7 |
-
|
| 8 |
-
# Step 3: No clicked
|
| 9 |
-
def no_action():
|
| 10 |
-
return func2()
|
| 11 |
|
| 12 |
with gr.Blocks() as demo:
|
| 13 |
|
| 14 |
-
|
| 15 |
-
label="
|
| 16 |
)
|
| 17 |
-
|
| 18 |
output = gr.Textbox(
|
| 19 |
-
label="
|
| 20 |
)
|
| 21 |
|
| 22 |
yes_btn = gr.Button(
|
| 23 |
-
"
|
| 24 |
visible=False
|
| 25 |
)
|
| 26 |
|
| 27 |
no_btn = gr.Button(
|
| 28 |
-
"
|
| 29 |
visible=False
|
| 30 |
)
|
| 31 |
-
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
outputs="here is summary,good click yes button"
|
| 39 |
-
)
|
| 40 |
-
|
| 41 |
-
# User clicks Yes
|
| 42 |
-
yes_btn.click(
|
| 43 |
-
yes_action
|
| 44 |
-
|
| 45 |
)
|
| 46 |
|
| 47 |
-
|
| 48 |
-
no_btn.click(
|
| 49 |
-
no_action
|
| 50 |
-
|
| 51 |
-
)
|
| 52 |
|
| 53 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
|
| 4 |
+
def describe_topic(topic):
|
| 5 |
+
return f"You entered: {topic}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
with gr.Blocks() as demo:
|
| 8 |
|
| 9 |
+
topic_input = gr.Textbox(
|
| 10 |
+
label="Enter a topic and I will simply describe it"
|
| 11 |
)
|
| 12 |
+
|
| 13 |
output = gr.Textbox(
|
| 14 |
+
label="description"
|
| 15 |
)
|
| 16 |
|
| 17 |
yes_btn = gr.Button(
|
| 18 |
+
"click here if you like the description",
|
| 19 |
visible=False
|
| 20 |
)
|
| 21 |
|
| 22 |
no_btn = gr.Button(
|
| 23 |
+
"if the description is not good, click here. I will try to find you a better description",
|
| 24 |
visible=False
|
| 25 |
)
|
|
|
|
| 26 |
|
| 27 |
+
|
| 28 |
+
topic_input.submit(
|
| 29 |
+
describe_topic,
|
| 30 |
+
inputs=topic_input,
|
| 31 |
+
outputs=output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
)
|
| 33 |
|
| 34 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
demo.launch()
|