Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from cart_tab import add_to_cart, display_cart
|
| 3 |
|
| 4 |
# Global variables for cart and menu data
|
| 5 |
cart = []
|
|
@@ -84,9 +83,11 @@ popup_js = """
|
|
| 84 |
document.getElementById("overlay").style.display = "none";
|
| 85 |
}
|
| 86 |
|
| 87 |
-
function addToCart(name) {
|
| 88 |
-
|
| 89 |
-
|
|
|
|
|
|
|
| 90 |
}
|
| 91 |
</script>
|
| 92 |
"""
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
# Global variables for cart and menu data
|
| 4 |
cart = []
|
|
|
|
| 83 |
document.getElementById("overlay").style.display = "none";
|
| 84 |
}
|
| 85 |
|
| 86 |
+
async function addToCart(name) {
|
| 87 |
+
// Call the Gradio backend function to add item to the cart
|
| 88 |
+
const response = await google.colab.kernel.invokeFunction('notebook.add_to_cart', [name], {});
|
| 89 |
+
alert(response.data); // Show a success message
|
| 90 |
+
closePopup(); // Close the popup
|
| 91 |
}
|
| 92 |
</script>
|
| 93 |
"""
|