File size: 940 Bytes
8cc5253
 
298d6c1
8cc5253
 
 
298d6c1
 
8cc5253
298d6c1
 
 
b2d2c46
298d6c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/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()