File size: 2,826 Bytes
8eab354 | 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 | """
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()
|