File size: 1,285 Bytes
95db528
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""
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()