fix: dead button work
Browse files- app/main.py +43 -42
app/main.py
CHANGED
@@ -2,19 +2,19 @@ import gradio as gr
|
|
2 |
|
3 |
|
4 |
|
5 |
-
def Dropdown_update(category):
|
6 |
-
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
|
19 |
|
20 |
def truck_dropdown():
|
@@ -22,8 +22,35 @@ def truck_dropdown():
|
|
22 |
|
23 |
def truckb_dropdown():
|
24 |
return gr.Dropdown(choices=["F", "W", "Z", "X"], label="Dropdown2", interactive=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
-
choices = ["A", "B", "C", "D"]
|
27 |
|
28 |
with gr.Blocks() as demo:
|
29 |
with gr.Row():
|
@@ -37,40 +64,14 @@ with gr.Blocks() as demo:
|
|
37 |
|
38 |
|
39 |
with gr.Column(scale=1):
|
40 |
-
gr.Radio(choices=["Wounded", "Dead"], label="State of the animal")
|
|
|
|
|
41 |
|
42 |
-
|
43 |
-
with gr.Row():
|
44 |
-
with gr.Column(scale=1):
|
45 |
-
img1 = gr.Image(value='./assets/van.png', show_download_button=False, show_label=False)
|
46 |
-
butt1 = gr.Button("Violently hit by a drunk driver")
|
47 |
-
# dropdown1 = gr.Dropdown(choices=choices, label="Dropdown")
|
48 |
-
|
49 |
-
with gr.Column(scale=1):
|
50 |
-
img1 = gr.Image(value='./assets/van.png', show_download_button=False, show_label=False)
|
51 |
-
butt2 = gr.Button("Violently hit by two drunk drivers")
|
52 |
-
# dropdown2 = gr.Dropdown(choices=choices, label="Dropdown")
|
53 |
-
|
54 |
-
|
55 |
-
with gr.Row():
|
56 |
-
with gr.Column(scale=1):
|
57 |
-
img3 = gr.Image(value='./assets/van.png', show_download_button=False, show_label=False)
|
58 |
-
# dropdown3 = gr.Dropdown(choices=choices, label="Dropdown")
|
59 |
-
|
60 |
-
with gr.Column(scale=1):
|
61 |
-
img4 = gr.Image(value='./assets/van.png', show_download_button=False, show_label=False)
|
62 |
-
# dropdown4 = gr.Dropdown(choices=choices, label="Dropdown")
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
with gr.Row():
|
67 |
-
dropdown = gr.Dropdown(choices=["A","B"], label="Dropdown", interactive=True)
|
68 |
-
|
69 |
with gr.Column(scale=1):
|
70 |
subbutt = gr.Button("Submit")
|
71 |
output_message = gr.Markdown("Thank you, you didn't save this one but you could save the next")
|
72 |
|
73 |
-
|
74 |
-
butt2.click(truckb_dropdown, outputs=dropdown)
|
75 |
|
76 |
demo.launch(server_name="0.0.0.0")
|
|
|
2 |
|
3 |
|
4 |
|
5 |
+
# def Dropdown_update(category):
|
6 |
+
# print(category)
|
7 |
|
8 |
+
# options_a = ["C","D","E"]
|
9 |
+
# options_b = ["C","D","E"]
|
10 |
+
# options_c = ["C","D","E"]
|
11 |
|
12 |
+
# if category == "category_a":
|
13 |
+
# return gr.Dropdown.update(choices=options_a)
|
14 |
+
# elif category == "category_b":
|
15 |
+
# return gr.Dropdown.update(choices=options_b)
|
16 |
+
# elif category == "category_c":
|
17 |
+
# return gr.Dropdown.update(choices=options_c)
|
18 |
|
19 |
|
20 |
def truck_dropdown():
|
|
|
22 |
|
23 |
def truckb_dropdown():
|
24 |
return gr.Dropdown(choices=["F", "W", "Z", "X"], label="Dropdown2", interactive=True)
|
25 |
+
|
26 |
+
|
27 |
+
def show_tab():
|
28 |
+
with gr.Tab("Dead/Wounded Information"):
|
29 |
+
|
30 |
+
with gr.Row():
|
31 |
+
with gr.Column(scale=1):
|
32 |
+
img1 = gr.Image(value='./assets/van.png', show_download_button=False, show_label=False)
|
33 |
+
butt1 = gr.Button("Violently hit by a drunk driver")
|
34 |
+
|
35 |
+
with gr.Column(scale=1):
|
36 |
+
img1 = gr.Image(value='./assets/van.png', show_download_button=False, show_label=False)
|
37 |
+
butt2 = gr.Button("Violently hit by two drunk drivers")
|
38 |
+
|
39 |
+
|
40 |
+
with gr.Row():
|
41 |
+
with gr.Column(scale=1):
|
42 |
+
img3 = gr.Image(value='./assets/van.png', show_download_button=False, show_label=False)
|
43 |
+
|
44 |
+
with gr.Column(scale=1):
|
45 |
+
img4 = gr.Image(value='./assets/van.png', show_download_button=False, show_label=False)
|
46 |
+
|
47 |
+
with gr.Row():
|
48 |
+
dropdown = gr.Dropdown(choices=["A","B"], label="Dropdown", interactive=True)
|
49 |
+
|
50 |
+
butt1.click(truck_dropdown, outputs=dropdown)
|
51 |
+
butt2.click(truckb_dropdown, outputs=dropdown)
|
52 |
+
|
53 |
|
|
|
54 |
|
55 |
with gr.Blocks() as demo:
|
56 |
with gr.Row():
|
|
|
64 |
|
65 |
|
66 |
with gr.Column(scale=1):
|
67 |
+
radio_dead = gr.Radio(choices=["Wounded", "Dead"], label="State of the animal")
|
68 |
+
|
69 |
+
radio_dead.change(show_tab())
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
with gr.Column(scale=1):
|
72 |
subbutt = gr.Button("Submit")
|
73 |
output_message = gr.Markdown("Thank you, you didn't save this one but you could save the next")
|
74 |
|
75 |
+
|
|
|
76 |
|
77 |
demo.launch(server_name="0.0.0.0")
|