Spaces:
Sleeping
Sleeping
Create item_popup.py
Browse files- components/item_popup.py +19 -0
components/item_popup.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def item_popup():
|
| 4 |
+
def get_item_details(item_name):
|
| 5 |
+
# Fetch item details from the menu
|
| 6 |
+
return {
|
| 7 |
+
"Image": "path/to/image.jpg",
|
| 8 |
+
"Nutrition": "High Protein",
|
| 9 |
+
"Serving Size": "200g"
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
with gr.Group():
|
| 13 |
+
gr.Markdown("### Item Details")
|
| 14 |
+
item_name = gr.Textbox(label="Item Name")
|
| 15 |
+
item_details = get_item_details(item_name)
|
| 16 |
+
gr.Image(item_details["Image"], label="Image")
|
| 17 |
+
gr.Text(f"Nutrition: {item_details['Nutrition']}")
|
| 18 |
+
gr.Text(f"Serving Size: {item_details['Serving Size']}")
|
| 19 |
+
gr.Button("Close")
|