Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -75,10 +75,10 @@ popup_js = """
|
|
| 75 |
overlay.style.display = "block";
|
| 76 |
|
| 77 |
document.getElementById("add-to-cart-button").onclick = async function() {
|
| 78 |
-
const response = await fetch(
|
| 79 |
-
method:
|
| 80 |
body: JSON.stringify({ name }),
|
| 81 |
-
headers: {
|
| 82 |
});
|
| 83 |
const result = await response.json();
|
| 84 |
alert(result.data); // Show success message
|
|
@@ -140,7 +140,7 @@ with gr.Blocks() as demo:
|
|
| 140 |
outputs=cart_display
|
| 141 |
)
|
| 142 |
|
| 143 |
-
#
|
| 144 |
-
demo.
|
| 145 |
|
| 146 |
demo.launch()
|
|
|
|
| 75 |
overlay.style.display = "block";
|
| 76 |
|
| 77 |
document.getElementById("add-to-cart-button").onclick = async function() {
|
| 78 |
+
const response = await fetch("/run/add_to_cart", {
|
| 79 |
+
method: "POST",
|
| 80 |
body: JSON.stringify({ name }),
|
| 81 |
+
headers: { "Content-Type": "application/json" }
|
| 82 |
});
|
| 83 |
const result = await response.json();
|
| 84 |
alert(result.data); // Show success message
|
|
|
|
| 140 |
outputs=cart_display
|
| 141 |
)
|
| 142 |
|
| 143 |
+
# Gradio serves all registered functions automatically
|
| 144 |
+
demo.add_to_cart = add_to_cart
|
| 145 |
|
| 146 |
demo.launch()
|