File size: 1,685 Bytes
a8620b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
08b8d1d
a8620b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
57
58
59
#!/usr/bin/env python3
"""
Multi-Agent Finance Assistant
Hugging Face Spaces Deployment Entry Point
"""

import os
import sys
import warnings
warnings.filterwarnings("ignore")

# Add the current directory to Python path
sys.path.append(os.path.dirname(os.path.abspath(__file__)))

# Import the main application
try:
    from finance_assistant_main import create_interface
    
    # Create and launch the interface
    if __name__ == "__main__":
        print("πŸš€ Starting Multi-Agent Finance Assistant...")
        print("πŸ“Š Initializing AI agents...")
        
        interface = create_interface()
        
        print("βœ… Application ready!")
        print("🌐 Launching Gradio interface...")
        
        interface.launch(
            server_name="0.0.0.0",
            server_port=7860,
            share=False,  # HF Spaces handles sharing
            show_api=False,
            enable_monitoring=False
        )
        
except ImportError as e:
    print(f"❌ Import error: {e}")
    print("πŸ“ Current directory contents:")
    print(os.listdir('.'))
    
    # Fallback simple interface
    import gradio as gr
    
    def fallback_interface():
        return gr.Interface(
            fn=lambda x: "Finance Assistant is starting up. Please check back in a moment.",
            inputs=gr.Textbox(label="Query"),
            outputs=gr.Textbox(label="Response"),
            title="Multi-Agent Finance Assistant",
            description="Loading AI agents..."
        )
    
    fallback_interface().launch(server_name="0.0.0.0", server_port=7860)

except Exception as e:
    print(f"❌ Startup error: {e}")
    import traceback
    traceback.print_exc()