Spaces:
Sleeping
Sleeping
| """ | |
| Main entry point for the validation module. | |
| This module provides the main application entry point for running the | |
| validation API server independently or for testing purposes. | |
| """ | |
| import uvicorn | |
| import logging | |
| from typing import Optional | |
| from .api import app | |
| from .config import config | |
| # Configure logging | |
| logging.basicConfig( | |
| level=logging.INFO, | |
| format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' | |
| ) | |
| logger = logging.getLogger(__name__) | |
| def main( | |
| host: str = "0.0.0.0", | |
| port: int = 7860, | |
| reload: bool = False, | |
| log_level: str = "info" | |
| ): | |
| """ | |
| Run the validation API server. | |
| Parameters | |
| ---------- | |
| host : str, optional | |
| Host to bind the server to, by default "0.0.0.0" | |
| port : int, optional | |
| Port to bind the server to, by default 7860 | |
| reload : bool, optional | |
| Whether to enable auto-reload for development, by default False | |
| log_level : str, optional | |
| Logging level, by default "info" | |
| """ | |
| logger.info("Starting Validation API server") | |
| logger.info(f"Configuration: {config.model_paths}") | |
| uvicorn.run( | |
| "src.validate.api:app", | |
| host=host, | |
| port=port, | |
| reload=reload, | |
| log_level=log_level | |
| ) | |
| if __name__ == "__main__": | |
| main() | |