Spaces:
Sleeping
Sleeping
File size: 660 Bytes
9abcdcf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | from flask import Flask, render_template, request, jsonify
import os
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
@app.route('/api/greet', methods=['POST'])
def greet():
data = request.get_json()
name = data.get('name', 'World')
return jsonify({
'message': f'Hello, {name}!',
'status': 'success'
})
@app.route('/health')
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) |