InklyAI / demo_web_ui.py
pravinai's picture
Upload folder using huggingface_hub
8eab354 verified
"""
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()