#!/usr/bin/env python3 """ Simple launcher for SyncMaster with integrated server مُشغل بسيط مع خادم متكامل - مثالي لـ HuggingFace """ import streamlit as st import os import sys import time # Add current directory to path sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) # Initialize integrated server first recorder_server_started = False def start_integrated_server(): """Start the integrated recorder server""" global recorder_server_started if recorder_server_started: return True try: from integrated_server import ensure_recorder_server result = ensure_recorder_server() if result: recorder_server_started = True st.success("✅ Integrated recorder server is running on port 5001") else: st.warning("⚠️ Could not start integrated recorder server") return result except Exception as e: st.error(f"❌ Error starting integrated recorder server: {e}") return False # Start the integrated server when the module loads start_integrated_server() # Import the main app module try: import app except Exception as e: st.error(f"❌ Error loading main application: {e}") st.stop() if __name__ == "__main__": print("🚀 SyncMaster main.py executed directly")