"""Hugging Face Space entry point. Imports the Dash app from src/m4_dashboard/app.py and runs it on port 7860, which is what HF Spaces routes externally. """ import os import sys ROOT = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, os.path.join(ROOT, "src", "m4_dashboard")) # Importing app builds the layout and registers callbacks from app import app # noqa: E402 # Expose the Flask server for any WSGI host (e.g. gunicorn) server = app.server if __name__ == "__main__": port = int(os.environ.get("PORT", "7860")) print(f"[microplastinet-hf] starting Dash on 0.0.0.0:{port}") app.run(host="0.0.0.0", port=port, debug=False, use_reloader=False)