Spaces:
Runtime error
Runtime error
Download app.py from BaoLoi2003/web-app: direct link, hf CLI and curl.
- Browser
- Download file 923 Bytes
-
https://huggingface.co/spaces/BaoLoi2003/web-app/resolve/main/app.py
- Command line
-
hf download hf://spaces/BaoLoi2003/web-app/app.py
-
curl -L -o app.py https://huggingface.co/spaces/BaoLoi2003/web-app/resolve/main/app.py
923 Bytes
| import os | |
| # from flask import Flask | |
| from flask import (Flask, redirect, render_template, request, | |
| send_from_directory, url_for) | |
| app = Flask(__name__) | |
| # @app.route('/') | |
| # def hello(): | |
| # return "Hello from Flask (in Docker)" | |
| def index(): | |
| print('Request for index page received') | |
| return render_template('index.html') | |
| def favicon(): | |
| return send_from_directory(os.path.join(app.root_path, 'static'), | |
| 'favicon.ico', mimetype='image/vnd.microsoft.icon') | |
| def hello(): | |
| name = request.form.get('name') | |
| if name: | |
| print('Request for hello page received with name=%s' % name) | |
| return render_template('hello.html', name = name) | |
| else: | |
| print('Request for hello page received with no name or blank name -- redirecting') | |
| return redirect(url_for('index')) | |