Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
from components.cards import create_food_card
|
3 |
from components.data import FOOD_DATA
|
4 |
|
@@ -19,8 +20,8 @@ with gr.Blocks(css="styles.css") as app:
|
|
19 |
"""
|
20 |
)
|
21 |
|
22 |
-
#
|
23 |
-
|
24 |
|
25 |
# Display all items as a vertical list
|
26 |
with gr.Column(elem_id="food-list"):
|
@@ -30,13 +31,10 @@ with gr.Blocks(css="styles.css") as app:
|
|
30 |
elem_id=f"food-{food_name.replace(' ', '-').lower()}",
|
31 |
interactive=True,
|
32 |
).click(
|
33 |
-
display_card,
|
34 |
-
inputs=
|
35 |
-
outputs=
|
36 |
)
|
37 |
|
38 |
-
# Add the popup area to the app
|
39 |
-
popup_area.style()
|
40 |
-
|
41 |
# Launch the app
|
42 |
app.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from gradio_modal import Modal
|
3 |
from components.cards import create_food_card
|
4 |
from components.data import FOOD_DATA
|
5 |
|
|
|
20 |
"""
|
21 |
)
|
22 |
|
23 |
+
# Initialize the modal
|
24 |
+
modal = Modal()
|
25 |
|
26 |
# Display all items as a vertical list
|
27 |
with gr.Column(elem_id="food-list"):
|
|
|
31 |
elem_id=f"food-{food_name.replace(' ', '-').lower()}",
|
32 |
interactive=True,
|
33 |
).click(
|
34 |
+
lambda x=food_name: (modal.show(), display_card(x)),
|
35 |
+
inputs=None,
|
36 |
+
outputs=[modal, modal.content]
|
37 |
)
|
38 |
|
|
|
|
|
|
|
39 |
# Launch the app
|
40 |
app.launch()
|