File size: 964 Bytes
1d75522
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Initialize and download models in Hugging Face Spaces environment."""

import os
import asyncio
import logging
from huggingface_hub import HfApi
from reasoning.model_manager import ModelManager

# Configure logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

async def initialize_space_models():
    """Download and initialize models in Spaces environment."""
    try:
        # Initialize model manager
        manager = ModelManager()
        
        # Download all models
        logger.info("Starting model downloads in Spaces environment...")
        await manager.initialize_all_models()
        logger.info("All models downloaded and initialized successfully!")
        
        return True
        
    except Exception as e:
        logger.error(f"Error initializing models in Spaces: {e}")
        return False

if __name__ == "__main__":
    # Initialize models in Spaces
    asyncio.run(initialize_space_models())