Spaces:
Runtime error
Runtime error
Download Stack/stack_app.py from swetha-coding/dsahub: direct link, hf CLI and curl.
- Browser
- Download file 680 Bytes
-
https://huggingface.co/spaces/swetha-coding/dsahub/resolve/main/Stack/stack_app.py
- Command line
-
hf download hf://spaces/swetha-coding/dsahub/Stack/stack_app.py
-
curl -L -o stack_app.py https://huggingface.co/spaces/swetha-coding/dsahub/resolve/main/Stack/stack_app.py
680 Bytes
| from flask import Blueprint, render_template, request | |
| stack_app = Blueprint("stack_app", __name__, template_folder="templates") | |
| stack = [] | |
| def index(): | |
| return render_template("stack.html", stack=stack) | |
| def push(): | |
| item = request.form["item"] | |
| stack.append(item) | |
| return render_template("stack.html", stack=stack) | |
| def pop(): | |
| if stack: | |
| stack.pop() | |
| return render_template("stack.html", stack=stack) | |
| def peek(): | |
| top = stack[-1] if stack else None | |
| return render_template("stack.html", stack=stack, top=top) | |