|
|
""" |
|
|
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) |
|
|
|
|
|
|
|
|
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") |
|
|
|
|
|
|
|
|
print("\nβ³ Starting web server...") |
|
|
server_thread = Thread(target=start_web_server, daemon=True) |
|
|
server_thread.start() |
|
|
|
|
|
|
|
|
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: |
|
|
|
|
|
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() |
|
|
|