CurryMindFree commited on
Commit
8f5dd56
·
verified ·
1 Parent(s): 784f767

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -31
app.py CHANGED
@@ -1,53 +1,36 @@
1
  import gradio as gr
2
 
3
 
4
- # Step 2: Yes clicked
5
- def yes_action(one):
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
- first_input = gr.Textbox(
15
- label="enter a topic here"
16
  )
17
-
18
  output = gr.Textbox(
19
- label="Output"
20
  )
21
 
22
  yes_btn = gr.Button(
23
- "Yes",
24
  visible=False
25
  )
26
 
27
  no_btn = gr.Button(
28
- "No",
29
  visible=False
30
  )
31
-
32
 
33
- # User presses Enter in the first textbox
34
- first_input.submit(
35
- gr.update(visible=True),
36
- gr.update(visible=True),
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
- # User clicks No
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()