""" Demo script for InklyAI Web UI """ import os import sys import time import webbrowser from threading import Thread import subprocess def start_web_server(): """Start the web server in a separate thread.""" try: from web_app import app app.run(host='0.0.0.0', port=5000, debug=False) except Exception as e: print(f"Error starting web server: {e}") def open_browser(): """Open browser after a delay.""" time.sleep(3) webbrowser.open('http://localhost:5000') def demo_web_ui(): """Demonstrate the web UI.""" print("🌐 InklyAI Web UI Demo") print("=" * 50) # Check if sample data exists if not os.path.exists('data/samples/john_doe_1.png'): print("Creating sample signatures...") from demo import create_sample_signatures create_sample_signatures() print("āœ… Sample signatures created") print("\nšŸš€ Starting InklyAI Web Application...") print("šŸ“± Features available:") print(" • Signature Upload & Verification") print(" • Agent Management") print(" • Real-time Statistics") print(" • Drag & Drop Interface") print(" • Mobile Responsive Design") print("\n🌐 Web UI will open at: http://localhost:8080") print("šŸ“Š Agent Management at: http://localhost:8080/agents") print("šŸ”§ API Documentation at: http://localhost:8080/api/health") print("\nšŸ“‹ Available Agents:") print(" • Agent_01 (John Doe)") print(" • Agent_02 (Jane Smith)") print(" • Agent_03 (Bob Wilson)") print(" • Agent_04 (Alice Brown)") print("\nšŸŽÆ How to use the Web UI:") print("1. Select an agent from the dropdown") print("2. Upload a reference signature") print("3. Upload a signature to verify") print("4. Click 'Verify Signatures'") print("5. View the verification results") print("\nšŸ”§ Agent Management:") print("1. Go to the Agents page") print("2. Register new agents with signature templates") print("3. View agent statistics") print("4. Activate/deactivate agents") # Start web server in background print("\nā³ Starting web server...") server_thread = Thread(target=start_web_server, daemon=True) server_thread.start() # Open browser browser_thread = Thread(target=open_browser, daemon=True) browser_thread.start() print("\nāœ… Web server started!") print("🌐 Opening browser...") print("\nPress Ctrl+C to stop the server") try: # Keep the main thread alive while True: time.sleep(1) except KeyboardInterrupt: print("\n\nšŸ‘‹ Shutting down InklyAI Web UI...") print("Thank you for using InklyAI!") if __name__ == "__main__": demo_web_ui()