Spaces:
Running
Running
#!/usr/bin/env python3 | |
""" | |
Tokenizer Pro - Advanced tokenization analysis and visualization | |
This is the main entry point for the Flask application. | |
""" | |
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 | |
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) |