File size: 3,463 Bytes
1a01a01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/usr/bin/env python3
"""
Simplified ID Agents App for Troubleshooting
This version isolates potential import issues and provides basic functionality
"""

import gradio as gr
import json
import os

# Simple authentication test
def create_simple_app():
    """Create a simplified version of the ID Agents app"""
    
    with gr.Blocks(title="ID Agents - Test Version") as app:
        
        # Custom CSS (minimal)
        app.css = """
        .main-container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }
        """
        
        # Header
        gr.Markdown("# 🦠 ID Agents - Test Version")
        gr.Markdown("This is a simplified version to test basic functionality and authentication.")
        
        # Simple chat interface
        with gr.Row():
            with gr.Column(scale=1):
                gr.Markdown("### Quick Test Panel")
                test_input = gr.Textbox(label="Test Input", placeholder="Type a message...")
                test_btn = gr.Button("Send Test")
                
            with gr.Column(scale=2):
                gr.Markdown("### Chat Test")
                chatbot = gr.Chatbot(label="Test Chat")
                
        # Simple function
        def test_response(message):
            if not message.strip():
                return [["", "Please enter a message to test."]]
            
            response = f"βœ… Test successful! You said: '{message}'"
            return [["Test User", message], ["ID Agents Test", response]]
        
        # Connect the function
        test_btn.click(
            test_response,
            inputs=[test_input],
            outputs=[chatbot]
        )
        
        # Footer
        gr.Markdown("---")
        gr.Markdown("πŸ§ͺ **Test Status**: If you can see this interface and interact with it, the basic setup is working!")
        
    return app

def main():
    """Main function with authentication"""
    print("πŸ§ͺ Starting ID Agents Test Version...")
    
    # Create the app
    try:
        app = create_simple_app()
        print("βœ… App created successfully")
    except Exception as e:
        print(f"❌ Failed to create app: {e}")
        return
    
    # Authentication credentials (simplified)
    auth_credentials = [
        ("test", "test123"),
        ("admin", "admin123"),
        ("dr_smith", "idweek2025"),
        ("guest", "guest123")
    ]
    
    auth_message = """
    πŸ§ͺ **ID Agents Test Version**
    
    Test credentials:
    β€’ test / test123
    β€’ admin / admin123  
    β€’ dr_smith / idweek2025
    β€’ guest / guest123
    """
    
    # Launch configuration
    launch_config = {
        "auth": auth_credentials,
        "auth_message": auth_message,
        "server_name": "0.0.0.0",
        "server_port": 7860,
        "share": False,
        "show_error": True
    }
    
    print("πŸ” Authentication enabled")
    print("πŸš€ Launching app...")
    
    try:
        app.launch(**launch_config)
    except Exception as e:
        print(f"❌ Failed to launch app: {e}")
        # Try without authentication as fallback
        print("πŸ”„ Trying without authentication...")
        try:
            app.launch(
                server_name="0.0.0.0",
                server_port=7860,
                share=False
            )
        except Exception as e2:
            print(f"❌ Complete failure: {e2}")

if __name__ == "__main__":
    main()