Spaces:
Running
Running
File size: 1,058 Bytes
d66ab65 |
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 |
#!/usr/bin/env python3
"""
Tokenizer Pro - HuggingFace Space Launcher
This file serves as the entry point for HuggingFace Spaces, which expects app.py.
It imports and runs the restructured Flask application from the app/ package.
"""
import os
from app import create_app
from config import Config, DevelopmentConfig, ProductionConfig
def get_config_class():
"""Determine which configuration class to use based on environment."""
env = os.getenv('FLASK_ENV', 'development').lower()
if env == 'production':
return ProductionConfig
elif env == 'development':
return DevelopmentConfig
else:
return Config
# Create the Flask application using the app factory
app = create_app(get_config_class())
if __name__ == "__main__":
# Get configuration from environment variables
host = os.getenv('HOST', '0.0.0.0')
port = int(os.getenv('PORT', 7860))
debug = os.getenv('DEBUG', 'False').lower() in ('true', '1', 'yes')
app.run(host=host, port=port, debug=debug) |