#!/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()