File size: 2,418 Bytes
7498f2c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
db70e19
7498f2c
 
 
 
 
 
 
 
 
 
 
 
db70e19
7498f2c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
60
61
62
63
64
#!/usr/bin/env python3
"""

Multi-Agent Job Application Assistant - HuggingFace Spaces Deployment

Production-ready system with Gemini 2.5 Flash, A2A Protocol, and MCP Integration

Features: Resume/Cover Letter Generation, Job Matching, Document Export, Advanced AI Agents

"""

# Use the hf_app.py as the main app for HuggingFace Spaces
from hf_app import *

if __name__ == "__main__":
    # Configure for HuggingFace Spaces deployment
    import os
    
    # Set up HF-specific configurations
    os.environ.setdefault("GRADIO_SERVER_NAME", "0.0.0.0")
    os.environ.setdefault("GRADIO_SERVER_PORT", str(os.getenv("PORT", "7860")))
    
    print("πŸš€ Starting Multi-Agent Job Application Assistant on HuggingFace Spaces")
    print("=" * 70)
    print("Features:")
    print("βœ… Gemini 2.5 Flash AI Generation")
    print("βœ… Advanced Multi-Agent System (A2A Protocol)")
    print("βœ… Resume & Cover Letter Generation")
    print("βœ… Job Matching & Research")
    print("βœ… Document Export (Word/PowerPoint/Excel)")
    print("βœ… MCP Server Integration")
    print("=" * 70)
    
    try:
        app = build_app()
        app.launch(
            server_name="0.0.0.0",
            server_port=int(os.getenv("PORT", 7860)),
            share=False,
            show_error=True
        )
    except Exception as e:
        print(f"❌ Startup Error: {e}")
        print("\nπŸ”§ Troubleshooting:")
        print("1. Check environment variables in Space settings")
        print("2. Verify all dependencies in requirements.txt")
        print("3. Check logs for detailed error information")
        
        # Fallback: Simple demo interface
        print("\nπŸ”„ Starting simplified interface...")
        import gradio as gr
        
        def simple_demo(input_text):
            return "Multi-Agent Job Application Assistant is initializing. Please check back in a moment."
        
        demo = gr.Interface(
            fn=simple_demo,
            inputs=gr.Textbox(label="Status Check"),
            outputs=gr.Textbox(label="System Status"),
            title="πŸš€ Job Application Assistant",
            description="Production-ready multi-agent system for job applications"
        )
        
        demo.launch(
            server_name="0.0.0.0",
            server_port=int(os.getenv("PORT", 7860)),
            share=False
        )