File size: 1,613 Bytes
198b424
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import sys
import logging

# Configure logging
logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
    handlers=[logging.StreamHandler(sys.stdout)]
)
logger = logging.getLogger(__name__)

# Log system information
logger.info("Starting Conversational Speech System")
logger.info(f"Python version: {sys.version}")
logger.info(f"Current directory: {os.getcwd()}")

try:
    # Run setup to optimize environment
    logger.info("Running setup...")
    import setup
    setup.preload_models()
    
    # Import the main application
    logger.info("Importing speech conversation app...")
    from speech_conversation_app import demo
    
    # Launch the application
    logger.info("Launching application...")
    demo.launch()
    
except Exception as e:
    logger.error(f"Failed to start application: {e}", exc_info=True)
    
    # Fallback to basic Gradio interface if the main app fails
    import gradio as gr
    
    def fallback_app():
        with gr.Blocks() as fallback_demo:
            gr.Markdown("""
            # Conversational Speech System
            
            **Error:** The application encountered a problem during startup.
            
            Common issues:
            - Memory limitations on the hosting environment
            - Missing dependencies
            - GPU resource limitations
            
            Please check the logs for more details or try again later.
            """)
        
        return fallback_demo
    
    logger.info("Launching fallback application...")
    fallback_app().launch()