Spaces:
Sleeping
Sleeping
File size: 640 Bytes
198ccdc 53cf867 198ccdc 53cf867 198ccdc 53cf867 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | from flask import Flask, render_template, send_from_directory, jsonify
import os
app = Flask(__name__, static_folder='static')
@app.route('/')
def index():
try:
return render_template('index.html')
except Exception as e:
return f"An error occurred: {str(e)}", 500
@app.route('/health')
def health():
return jsonify({"status": "healthy"}), 200
# Flask serves static files automatically from the 'static' folder
# at the /static endpoint. No need for a manual route unless customizing.
if __name__ == '__main__':
port = int(os.environ.get('PORT', 7860))
app.run(debug=True, host='0.0.0.0', port=port)
|