duqing2026's picture
Update: Added default gradient background, fixed UI layout, and improved demo data
9ed069f
raw
history blame contribute delete
994 Bytes
import os
from flask import Flask, render_template, send_from_directory, jsonify
app = Flask(__name__, static_folder='static', template_folder='templates')
@app.route('/')
def index():
try:
return render_template('index.html')
except Exception as e:
return jsonify({"error": str(e), "message": "Template rendering failed. Please check server logs."}), 500
@app.route('/health')
def health():
return jsonify({"status": "ok", "service": "carousel-maker-pro"})
@app.route('/static/<path:path>')
def serve_static(path):
return send_from_directory('static', path)
@app.errorhandler(500)
def internal_error(error):
return jsonify({"error": "Internal Server Error", "details": str(error)}), 500
@app.errorhandler(404)
def not_found(error):
return jsonify({"error": "Not Found", "path": str(error)}), 404
if __name__ == '__main__':
# Use 7860 for Hugging Face Spaces
port = int(os.environ.get('PORT', 7860))
app.run(host='0.0.0.0', port=port)