Spaces:
Sleeping
Sleeping
| from flask import Flask, render_template, send_from_directory, request | |
| import os | |
| app = Flask(__name__) | |
| # Config for robustness | |
| app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 # 16MB max upload limit | |
| app.config['TEMPLATES_AUTO_RELOAD'] = True | |
| def index(): | |
| return render_template('index.html') | |
| def send_static(path): | |
| return send_from_directory('static', path) | |
| def health(): | |
| return "OK", 200 | |
| if __name__ == '__main__': | |
| port = int(os.environ.get('PORT', 7860)) | |
| # Disable debug in production-like environments if needed, but for Spaces it's fine usually. | |
| # We use 0.0.0.0 for external access | |
| app.run(host='0.0.0.0', port=port) | |