#!/usr/bin/env python3 """ Main application entry point for Hugging Face Spaces """ import os import sys from pathlib import Path def main(): """Main entry point""" print("🚀 Textilindo AI Assistant - Starting...") # Check if we're in a Hugging Face Space if os.getenv("SPACE_ID"): print("🌐 Running in Hugging Face Space") # Import and run the HF Spaces app try: from app_hf_spaces import main as run_hf_app run_hf_app() except ImportError as e: print(f"❌ Error importing HF app: {e}") # Fallback to health check from health_check import app app.run(host="0.0.0.0", port=7860, debug=False) else: print("💻 Running locally") # Run the health check server from health_check import app app.run(host="0.0.0.0", port=7860, debug=True) if __name__ == "__main__": main()