42 lines
979 B
Python
42 lines
979 B
Python
#!/usr/bin/env python3
|
|
"""Flask web application for ORA editing."""
|
|
|
|
import logging
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
from flask import Flask, render_template
|
|
|
|
# Ensure the package can be imported
|
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
|
|
|
from ora_editor.config import TEMP_DIR
|
|
from ora_editor.routes import (
|
|
files_bp, layers_bp, images_bp, polygon_bp, mask_bp, krita_bp, sam_bp
|
|
)
|
|
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
app = Flask(__name__, template_folder='templates')
|
|
|
|
|
|
@app.route('/')
|
|
def index():
|
|
"""Serve the main editor UI."""
|
|
return render_template('editor.html')
|
|
|
|
|
|
# Register blueprints
|
|
app.register_blueprint(files_bp)
|
|
app.register_blueprint(layers_bp)
|
|
app.register_blueprint(images_bp)
|
|
app.register_blueprint(polygon_bp)
|
|
app.register_blueprint(mask_bp)
|
|
app.register_blueprint(krita_bp)
|
|
app.register_blueprint(sam_bp)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
app.run(debug=False, port=5001, host='0.0.0.0')
|