Spaces:
Build error
Build error
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() |