Spaces:
Running
Running
Download app.py from phaethon-order/tech-trans-rag: direct link, hf CLI and curl.
- Browser
- Download file 873 Bytes
-
https://huggingface.co/spaces/phaethon-order/tech-trans-rag/resolve/main/app.py
- Command line
-
hf download hf://spaces/phaethon-order/tech-trans-rag/app.py
-
curl -L -o app.py https://huggingface.co/spaces/phaethon-order/tech-trans-rag/resolve/main/app.py
873 Bytes
| import os | |
| from flask import Flask | |
| from flask_cors import CORS | |
| import infrastructure.database as db | |
| from infrastructure.logger import get_logger, setup_logger | |
| from routes.api import api_bp | |
| from routes.web import web_bp | |
| setup_logger() | |
| def create_app(): | |
| app = Flask(__name__, template_folder="static") | |
| CORS(app) | |
| for k, v in { | |
| "XDG_CACHE_HOME": "/tmp/cache", | |
| "HF_HOME": "/tmp/huggingface", | |
| "TRANSFORMERS_CACHE": "/tmp/huggingface/transformers", | |
| }.items(): | |
| os.environ.setdefault(k, v) | |
| os.makedirs(os.path.abspath(v), exist_ok=True) | |
| app.register_blueprint(web_bp) | |
| app.register_blueprint(api_bp) | |
| with app.app_context(): | |
| get_logger().info("Initializing Neon database") | |
| db.init_db() | |
| return app | |
| if __name__ == "__main__": | |
| app = create_app() | |
| app.run(host="0.0.0.0", port=7860) | |