Spaces:
Sleeping
Sleeping
File size: 2,087 Bytes
b2e7796 bc1fb7d 170cfc0 bc1fb7d b46360a bc1fb7d b46360a bc1fb7d b46360a bc1fb7d b46360a bc1fb7d b46360a bc1fb7d b46360a 9a853cf 7a6e646 b46360a | 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 59 60 61 62 63 64 | """
MelanoScope AI - Skin Lesion Classification Application
Enterprise-ready deep learning application for dermatoscopic image analysis.
Author: Daniel Cavadia
Institution: Universidad Central de Venezuela
"""
import logging
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent / "src"))
from src.config.settings import LogConfig, AppConfig, EnvConfig
from src.core.model import MelanoScopeModel
from src.ui.components import MelanoScopeUI
def setup_logging() -> None:
"""Configure application logging."""
log_level = getattr(logging, LogConfig.LOG_LEVEL.upper(), logging.INFO)
logging.basicConfig(level=log_level, format=LogConfig.LOG_FORMAT, handlers=[logging.StreamHandler(sys.stdout)])
def create_application():
"""Create and configure the application."""
logger = logging.getLogger(__name__)
try:
logger.info(f"Initializing {AppConfig.TITLE} v{AppConfig.VERSION}")
model = MelanoScopeModel()
model_info = model.get_model_info()
logger.info(f"Model loaded with {model_info['num_classes']} classes")
ui = MelanoScopeUI(model, model.classes)
interface = ui.create_interface()
logger.info("Application initialized successfully")
return interface
except Exception as e:
logger.error(f"Application initialization failed: {e}")
raise RuntimeError(f"Initialization failed: {e}")
def main():
"""Main entry point."""
setup_logging()
logger = logging.getLogger(__name__)
try:
app = create_application()
logger.info("Launching MelanoScope AI interface...")
app.launch(
server_name="0.0.0.0" if not EnvConfig.DEBUG else "127.0.0.1",
server_port=7860, share=False, debug=EnvConfig.DEBUG, show_error=EnvConfig.DEBUG
)
except KeyboardInterrupt:
logger.info("Application shutdown requested")
except Exception as e:
logger.error(f"Application failed: {e}")
sys.exit(1)
if __name__ == "__main__":
main()
|