Spaces:
Sleeping
Sleeping
| from flask import Flask, render_template, request, redirect, url_for | |
| app = Flask(__name__) | |
| # Store tasks in memory (would use a database in a real application) | |
| tasks = [] | |
| def index(): | |
| return render_template('index.html', tasks=tasks) | |
| def add(): | |
| task = request.form.get('task') | |
| if task: | |
| tasks.append(task) | |
| return redirect(url_for('index')) | |
| def delete(task_id): | |
| if 0 <= task_id < len(tasks): | |
| tasks.pop(task_id) | |
| return redirect(url_for('index')) | |
| if __name__ == '__main__': | |
| # Use port 7860 for Hugging Face Spaces | |
| app.run(debug=True, host='0.0.0.0', port=7860) | |