#!/usr/bin/env python3 """ PunimTag GUI Starter Simple script to demonstrate the system and guide next steps """ import os import subprocess import sys def check_requirements(): """Check if all requirements are met""" print("šŸ” Checking requirements...") # Check if photos directory exists if not os.path.exists('photos'): print("āŒ Photos directory not found") print(" Creating photos/ directory...") os.makedirs('photos', exist_ok=True) print(" āœ… Created photos/ directory") else: print("āœ… Photos directory exists") # Check if database exists if os.path.exists('punimtag_simple.db'): print("āœ… Database exists") # Get basic stats try: import sqlite3 conn = sqlite3.connect('punimtag_simple.db') c = conn.cursor() c.execute("SELECT COUNT(*) FROM images") image_count = c.fetchone()[0] c.execute("SELECT COUNT(*) FROM faces") face_count = c.fetchone()[0] c.execute("SELECT COUNT(*) FROM faces WHERE person_id IS NULL") unidentified_count = c.fetchone()[0] conn.close() print(f" šŸ“Š {image_count} images, {face_count} faces, {unidentified_count} unidentified") return image_count, face_count, unidentified_count except Exception as e: print(f" āš ļø Error reading database: {e}") return 0, 0, 0 else: print("āŒ Database not found") print(" Run 'python punimtag_simple.py' first to process images") return 0, 0, 0 def show_menu(image_count, face_count, unidentified_count): """Show main menu""" print("\n" + "="*60) print("šŸ·ļø PUNIMTAG - NEXT STEPS") print("="*60) if image_count == 0: print("šŸ“ GETTING STARTED:") print(" 1. Add photos to the 'photos/' directory") print(" 2. Run: python punimtag_simple.py") print(" 3. Come back here for face identification") print("\nšŸ’” TIP: Start with 10-20 photos for testing") return print(f"šŸ“Š CURRENT STATUS:") print(f" Images processed: {image_count}") print(f" Faces detected: {face_count}") print(f" Unidentified faces: {unidentified_count}") print(f"\nšŸŽÆ AVAILABLE ACTIONS:") print(f" 1. Process more images") print(f" 2. Identify unknown faces (CLI)") print(f" 3. Manage database") print(f" 4. View statistics") if unidentified_count > 0: print(f" 5. Start simple web interface (coming soon)") print(f" 6. Exit") def process_images(): """Process images""" print("\nšŸ“· Processing images...") try: result = subprocess.run([sys.executable, 'punimtag_simple.py'], capture_output=True, text=True) print(result.stdout) if result.stderr: print("Errors:", result.stderr) except Exception as e: print(f"Error: {e}") def identify_faces(): """Identify faces using CLI tool""" print("\nšŸ‘„ Starting face identification...") try: subprocess.run([sys.executable, 'interactive_identifier.py']) except Exception as e: print(f"Error: {e}") def manage_database(): """Manage database""" print("\nšŸ—„ļø Starting database manager...") try: subprocess.run([sys.executable, 'db_manager.py']) except Exception as e: print(f"Error: {e}") def show_statistics(): """Show detailed statistics""" print("\nšŸ“Š DETAILED STATISTICS") print("="*40) try: from db_manager import DatabaseManager manager = DatabaseManager('punimtag_simple.db') manager.inspect_database() except Exception as e: print(f"Error: {e}") def show_next_gui_steps(): """Show what's coming next for GUI development""" print("\nšŸš€ NEXT GUI DEVELOPMENT STEPS") print("="*50) print("We have a working backend! Next steps for GUI:") print() print("āœ… COMPLETED:") print(" • Face recognition and clustering") print(" • Database management") print(" • Jewish organization features") print(" • Search functionality") print(" • CLI tools for identification") print() print("šŸ”„ IN PROGRESS:") print(" • Web-based GUI with Flask") print(" • Face clustering visualization") print(" • Interactive face identification") print() print("šŸ“‹ PLANNED:") print(" • Advanced search interface") print(" • Tag management GUI") print(" • Statistics dashboard") print(" • Photo gallery with face highlights") print() print("šŸ’” TO TEST THE WEB GUI:") print(" 1. Make sure you have processed some images") print(" 2. Run: python web_gui.py (when ready)") print(" 3. Open http://localhost:5000 in browser") def main(): """Main function""" print("šŸ·ļø PunimTag GUI Starter") print("Welcome to the face recognition and photo tagging system!") # Check requirements image_count, face_count, unidentified_count = check_requirements() while True: show_menu(image_count, face_count, unidentified_count) try: choice = input(f"\nāž¤ Select option: ").strip() if choice == '1': process_images() # Refresh stats image_count, face_count, unidentified_count = check_requirements() elif choice == '2': if face_count == 0: print("āŒ No faces to identify. Process images first.") else: identify_faces() # Refresh stats image_count, face_count, unidentified_count = check_requirements() elif choice == '3': manage_database() # Refresh stats image_count, face_count, unidentified_count = check_requirements() elif choice == '4': show_statistics() elif choice == '5': if unidentified_count > 0: print("🌐 Web interface is in development!") print("For now, use option 2 for CLI identification.") else: print("āœ… All faces are identified!") elif choice == '6': break else: print("āŒ Invalid option") input("\nPress Enter to continue...") except KeyboardInterrupt: print("\n\nšŸ‘‹ Goodbye!") break except Exception as e: print(f"Error: {e}") input("Press Enter to continue...") print("\nšŸŽ‰ Thank you for using PunimTag!") show_next_gui_steps() if __name__ == "__main__": main()