Spaces:
Sleeping
Sleeping
| from flask import Flask, render_template, request, jsonify | |
| import os | |
| app = Flask(__name__) | |
| def home(): | |
| return render_template('index.html') | |
| def greet(): | |
| data = request.get_json() | |
| name = data.get('name', 'World') | |
| return jsonify({ | |
| 'message': f'Hello, {name}!', | |
| 'status': 'success' | |
| }) | |
| def health_check(): | |
| return jsonify({ | |
| 'status': 'healthy', | |
| 'message': 'Flask app is running successfully!' | |
| }) | |
| if __name__ == '__main__': | |
| port = int(os.environ.get('PORT', 7860)) | |
| app.run(host='0.0.0.0', port=port, debug=False) |