duqing2026's picture
chore: 增加默认演示数据,优化模板配置,确保HF运行稳定
224e9b3
from flask import Flask, render_template, request, jsonify, send_from_directory
import os
import json
from datetime import datetime
app = Flask(__name__)
# Configure Jinja2 to use [[ ]] to avoid conflict with Vue
class CustomFlask(Flask):
jinja_options = Flask.jinja_options.copy()
jinja_options.update(dict(
variable_start_string='[[',
variable_end_string=']]',
))
app = CustomFlask(__name__)
# Ensure storage directory exists
STORAGE_DIR = "storage"
if not os.path.exists(STORAGE_DIR):
os.makedirs(STORAGE_DIR)
PROJECT_INFO = {
"name": "interactive-map-studio",
"title_cn": "交互式地图工坊",
"short_description": "为图片添加交互式热点,制作可点击的楼层指引、游戏地图或产品展示图。",
"version": "1.0.0"
}
@app.route('/')
def index():
return render_template('index.html', project=PROJECT_INFO)
@app.route('/health')
def health():
return "OK"
if __name__ == '__main__':
port = int(os.environ.get('PORT', 7860))
app.run(host='0.0.0.0', port=port)