File size: 971 Bytes
7a674bb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | """
NETRA - Entry Point
Bootstraps the full application from webapp/app.py.
Run this file from the project root: python app.py
NETRA
"""
import sys
import runpy
from pathlib import Path
PROJECT_ROOT = Path(__file__).parent
sys.path.insert(0, str(PROJECT_ROOT))
if __name__ == '__main__':
import os
# Detect environment and set ports
is_hf_spaces = os.getenv('SYSTEM') == 'spaces' or os.path.exists('/.dockerenv')
if is_hf_spaces:
os.environ['PORT'] = '7860'
os.environ['FLASK_ENV'] = 'production'
os.environ['FLASK_DEBUG'] = '0'
else:
os.environ['PORT'] = os.getenv('PORT', '5001')
os.environ['FLASK_ENV'] = os.getenv('FLASK_ENV', 'development')
os.environ['FLASK_DEBUG'] = os.getenv('FLASK_DEBUG', '1')
os.environ['PYTHONUNBUFFERED'] = '1'
runpy.run_path(
str(PROJECT_ROOT / 'webapp' / 'app.py'),
run_name='__main__',
) |