Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Jagard11/Launcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ AI Project Launcher

A sophisticated Gradio-based application that automatically discovers, categorizes, and launches AI/ML projects with intelligent AI-powered launch command generation. Features comprehensive project analysis using Qwen models, automatic environment detection, persistent caching, background scanning, and one-click project launching.

✨ Key Features

  • 🧠 AI-Powered Launch Commands: Uses Qwen models to intelligently analyze projects and generate optimal launch commands
  • πŸ” Automatic Project Discovery: Scans specified directories for AI/ML projects with smart detection
  • 🐍 Environment Detection: Automatically detects Python environments (conda, venv, poetry, pipenv)
  • πŸ€– Dual AI Analysis: Uses both Ollama (Granite) and Qwen models for comprehensive project understanding
  • 🎨 Visual Project Icons: Generates unique colored icons for each project
  • πŸš€ One-Click Launching: Launches projects in their proper environments with AI-generated commands
  • πŸ“± Modern Web Interface: Beautiful, responsive Gradio interface with multiple views
  • πŸ’Ύ Persistent Storage: SQLite database stores all project metadata, launch commands, and analysis
  • πŸ”„ Background Scanning: Continuous monitoring for new projects and changes
  • ⚑ Incremental Updates: Only processes new or changed projects for efficiency
  • 🏷️ Smart Caching: Preserves AI-generated descriptions and launch commands
  • πŸ› οΈ Custom Launcher Creation: Automatically creates editable custom launcher scripts
  • 🌐 API Server: RESTful API for external integrations
  • πŸ“Š Database Management UI: Comprehensive database viewer and management interface

πŸ†• Latest Features

AI Launch Command Generation (Qwen Integration)

  • Intelligent Analysis: Qwen models analyze project structure, dependencies, and documentation
  • Multi-Option Analysis: Provides primary launch method with alternatives when available
  • Custom Launcher Scripts: Automatically creates editable bash scripts for complex projects
  • Confidence Scoring: AI provides confidence levels for launch command recommendations
  • Fallback Systems: Multiple fallback mechanisms ensure every project gets a launch method
  • User Override: Easy custom launcher editing with template generation

Unified Interface

  • Tabbed Interface: Integrated App List, Database Management, and Settings in one application
  • API Integration: Full RESTful API for programmatic access
  • Database UI: Comprehensive project database management and visualization
  • Command Line Options: Flexible startup configuration with verbose logging

Smart Project Management

  • Custom Launchers Directory: User-editable launcher scripts in custom_launchers/
  • Force Re-analysis: Re-run AI analysis for improved launch commands
  • Project Status Tracking: Comprehensive status and health monitoring
  • Launch History: Track successful launches and common patterns

πŸ—οΈ Architecture

The application uses a modular architecture with clear separation of concerns:

  • launcher.py - Main unified launcher with database integration, AI features, and tabbed interface
  • qwen_launch_analyzer.py - AI-powered launch command generation using Qwen models
  • database_ui.py - Comprehensive database management interface
  • launch_api_server.py - RESTful API server for external integrations
  • settings_ui.py - Settings configuration interface
  • project_database.py - SQLite database management and operations
  • background_scanner.py - Background scanning and incremental updates
  • launcher_ui.py - Core UI components and project management logic
  • project_scanner.py - Project discovery and identification
  • environment_detector.py - Python environment detection
  • ollama_summarizer.py - AI-powered project descriptions (Granite models)
  • icon_generator.py - Visual icon generation
  • logger.py - Comprehensive logging system
  • launch.py - Launch utilities and fallback methods

πŸ“‹ Requirements

  • Python 3.8+
  • Ollama installed and running (for project descriptions)
  • Ollama with Qwen models (for launch command generation):
    • qwen3:8b (primary, fast analysis)
    • qwen3:14b (advanced analysis for complex projects)
  • Granite models (for descriptions):
    • granite3.1-dense:8b
    • granite-code:8b
  • Linux environment with gnome-terminal (for launching)

Dependencies

gradio>=5.38.1
Pillow>=9.0.0
pathlib
pandas>=1.3.0

πŸš€ Quick Start

  1. Clone and Setup

    git clone <repository-url>
    cd Launcher
    pip install -r requirements.txt
  2. Install Required AI Models

    # Qwen models for launch command generation
    ollama pull qwen3:8b
    ollama pull qwen3:14b
    
    # Granite models for project descriptions
    ollama pull granite3.1-dense:8b
    ollama pull granite-code:8b
  3. Create Configuration Create a config.json file (ignored by git for privacy):

    {
      "index_directories": [
        "/path/to/your/ai/projects",
        "/another/project/directory"
      ]
    }
  4. Launch the Application

    ./launcher.sh

    Or run directly with options:

    python3 launcher.py                    # Default: Unified interface on port 7870
    python3 launcher.py --port 8080        # Custom port
    python3 launcher.py --verbose          # Verbose logging
    python3 launcher.py --no-api           # Disable API server
  5. Access the Interface

🎯 Usage

First Run Experience

  1. Configuration: Configure directories in the Settings tab if not done during setup
  2. Initial Discovery: Comprehensive scan of your configured directories
  3. Database Creation: Creates projects.db with all discovered projects
  4. AI Analysis: Both Qwen and Granite models analyze projects in the background
  5. Custom Launcher Generation: AI creates custom launcher scripts for each project
  6. Immediate Use: Projects are immediately launchable with AI-generated commands

Interface Navigation

The unified interface provides three main tabs:

  • πŸ“± App List: Browse and launch your projects with search and filtering
  • πŸ—„οΈ Database: Comprehensive database management and inspection tools
  • βš™οΈ Settings: Configure directories, manage settings, and view system status

AI Launch Command Generation

The system uses Qwen models to intelligently analyze each project:

  1. Structure Analysis: Examines files, dependencies, and project layout
  2. Documentation Review: Reads README files and comments for launch hints
  3. Pattern Recognition: Identifies common project types and frameworks
  4. Command Generation: Creates optimal launch commands with confidence scores
  5. Custom Launcher Creation: Generates editable bash scripts in custom_launchers/
  6. Alternative Options: Provides backup launch methods when multiple options exist

Custom Launcher Scripts

Every project gets a custom launcher script:

  • Location: custom_launchers/<project-name>.sh
  • Editable: Fully customizable by users
  • AI-Generated: Initially populated with AI analysis
  • Environment Variables: Includes guidance for env var configuration
  • Executable: Ready to run with proper permissions

Project Management

  • Force Re-analysis: Trigger new AI analysis for improved launch commands
  • Mark as Dirty: Queue projects for re-processing
  • Manual Scanning: Immediate directory scans for new projects
  • Database Management: Full CRUD operations via database UI

πŸ”§ Configuration

Directory Configuration

Create config.json in the project root:

{
  "index_directories": [
    "/media/user/AI/projects",
    "/home/user/git/ai-projects", 
    "/opt/ml-projects"
  ]
}

Database Configuration

  • Location: projects.db (SQLite)
  • Auto-creation: Database created on first run
  • Schema: Projects, scan sessions, launch analytics, and metadata
  • Backup: Recommended to backup projects.db periodically

AI Model Configuration

The system automatically uses available models:

  • Qwen Models: Primary for launch command generation
  • Granite Models: Secondary for project descriptions
  • Fallback: Heuristic analysis if AI models unavailable

Scanning Configuration

  • Quick Scan: Every 3 minutes (new projects)
  • Full Scan: Every 60 minutes (comprehensive verification)
  • AI Re-analysis: Every 24 hours (refresh launch commands)
  • Manual Triggers: Available via UI buttons

πŸ› οΈ Advanced Features

API Server

The integrated API server runs on port 7871 by default:

# Example API calls
curl http://localhost:7871/api/projects                    # List all projects
curl http://localhost:7871/api/projects/scan               # Trigger scan
curl -X POST http://localhost:7871/api/projects/launch \
  -H "Content-Type: application/json" \
  -d '{"project_path": "/path/to/project"}'               # Launch project

Database Management

# View all projects
sqlite3 projects.db "SELECT name, launch_command, launch_confidence FROM projects;"

# Force re-analysis
sqlite3 projects.db "UPDATE projects SET dirty_flag = 1;"

# View launch analytics
sqlite3 projects.db "SELECT * FROM scan_sessions ORDER BY start_time DESC LIMIT 10;"

# Custom launcher usage
sqlite3 projects.db "SELECT name, launch_type FROM projects WHERE launch_type = 'custom_launcher';"

Custom Launcher Management

# List all custom launchers
ls custom_launchers/

# Edit a custom launcher
nano custom_launchers/my-project.sh

# Test a custom launcher
./custom_launchers/my-project.sh

# Force regeneration of custom launcher
# (Use "Force Re-analyze" button in UI)

Advanced Logging

  • Application Log: logs/ai_launcher.log
  • Ollama Transactions: logs/ollama_transactions.log
  • API Access Log: logs/api_access.log
  • Launch History: Tracked in database

πŸ§ͺ Testing and Development

Component Testing

# Test Qwen launch analyzer (if available)
python3 -c "from qwen_launch_analyzer import QwenLaunchAnalyzer; print('OK')"

# Test database operations
python3 -c "from project_database import db; print(db.get_stats())"

# Test project scanning
python3 -c "from project_scanner import ProjectScanner; print('OK')"

Icon Generation Test

python3 icon_generator.py

Database Inspection

# View database structure
sqlite3 projects.db ".schema"

# Check project count
sqlite3 projects.db "SELECT COUNT(*) FROM projects;"

# View recent AI analysis
sqlite3 projects.db "SELECT name, launch_analysis_method, launch_confidence FROM projects WHERE launch_analyzed_at > strftime('%s', 'now', '-1 day');"

πŸ“ Project Structure

Launcher/
β”œβ”€β”€ launcher.py                   # Main unified launcher (App List + Database + Settings)
β”œβ”€β”€ qwen_launch_analyzer.py       # AI launch command generation
β”œβ”€β”€ database_ui.py               # Database management interface
β”œβ”€β”€ launch_api_server.py          # RESTful API server
β”œβ”€β”€ settings_ui.py               # Settings configuration interface
β”œβ”€β”€ project_database.py          # Database management and operations
β”œβ”€β”€ background_scanner.py         # Background scanning and updates
β”œβ”€β”€ launcher_ui.py               # Core UI components
β”œβ”€β”€ project_scanner.py           # Project discovery logic
β”œβ”€β”€ environment_detector.py      # Environment detection
β”œβ”€β”€ ollama_summarizer.py         # AI project descriptions
β”œβ”€β”€ icon_generator.py            # Icon generation
β”œβ”€β”€ logger.py                    # Comprehensive logging
β”œβ”€β”€ launch.py                    # Launch utilities
β”œβ”€β”€ launcher.sh                  # Launch script
β”œβ”€β”€ config.json                  # Configuration (git-ignored)
β”œβ”€β”€ requirements.txt             # Python dependencies
β”œβ”€β”€ projects.db                  # SQLite database (created at runtime)
β”œβ”€β”€ custom_launchers/            # Custom launcher scripts (git-ignored)
β”‚   β”œβ”€β”€ project1.sh
β”‚   β”œβ”€β”€ project2.sh
β”‚   └── ...
β”œβ”€β”€ logs/                        # Log files (git-ignored)
β”‚   β”œβ”€β”€ ai_launcher.log
β”‚   β”œβ”€β”€ ollama_transactions.log
β”‚   └── api_access.log
└── README.md                    # This file

🎨 Features in Detail

AI-Powered Launch Commands

Each project receives intelligent analysis:

  • Multi-Model Analysis: Qwen models analyze structure and documentation
  • Confidence Scoring: AI provides 0.0-1.0 confidence ratings
  • Alternative Methods: Multiple launch options when available
  • Custom Script Generation: Editable bash scripts for complex setups
  • Environment Integration: Automatic environment activation
  • Pattern Recognition: Recognizes common frameworks and tools

Project Cards

Each project displays:

  • Unique Icon: Generated with consistent colors
  • Environment Badge: Shows detected Python environment
  • Status Indicators: Up-to-date status, git repository, AI confidence
  • Launch Information: AI-generated command and confidence level
  • Custom Launcher: Indicates if custom script is available
  • Last Analysis: Timestamp of AI analysis

Smart Environment Handling

The launcher automatically:

  • Detects Environment: Identifies conda, venv, poetry, pipenv
  • Activates Environment: Sets up environment before launching
  • Finds Entry Points: Identifies main scripts and executables
  • Handles Complex Projects: Supports nested structures and frameworks
  • Creates Custom Scripts: Generates bash scripts for complex setups

πŸš€ Application Modes

The unified launcher provides a single interface with multiple tabs:

Interface Component Port Description
Main Interface 7870 Unified tabbed interface (App List + Database + Settings)
API Server 7871 RESTful API for external integrations

Interface Features Comparison

Feature Simple Launch (launch.py) Unified Launcher (launcher.py)
AI Launch Commands Fallback only Qwen-powered
Project Discovery Manual scan Background + Manual
Database Storage None SQLite with history
Custom Launchers None Auto-generated
API Server None Integrated
Multiple Interfaces No Tabbed (App List + Database + Settings)
Session Persistence None Full persistence
Port 7860 7870-7871

πŸ› Troubleshooting

Common Issues

  1. AI Models Not Available: Install Qwen and Granite models via Ollama
  2. Custom Launchers Not Working: Check permissions: chmod +x custom_launchers/*.sh
  3. Database Errors: Delete projects.db to reset (requires full rescan)
  4. Background Scanner Issues: Check logs for threading or permission errors
  5. Launch Command Failures: Edit custom launcher scripts in custom_launchers/

AI Analysis Issues

  • Low Confidence: Try "Force Re-analyze" or edit custom launcher script
  • Wrong Commands: Edit the generated script in custom_launchers/
  • Missing Models: Ensure Qwen models are installed: ollama list
  • Timeout Errors: Check Ollama service: ollama serve

Performance Optimization

  • Large Directories: Consider excluding non-project subdirectories
  • AI Performance: Ensure sufficient RAM for Qwen models (8GB+ recommended)
  • Database Size: Regularly cleanup old scan sessions
  • Custom Launchers: Use custom scripts for consistently problematic projects

Debug Mode

Enable detailed logging:

# Verbose logging
python3 launcher.py --verbose

# View real-time logs
tail -f logs/ai_launcher.log

# View AI model interactions
tail -f logs/ollama_transactions.log

# Database inspection
sqlite3 projects.db ".tables"

🀝 Contributing

  1. Follow the cursor rules for project structure
  2. Keep UI components in feature modules (*_ui.py)
  3. Maintain separation between core logic and UI
  4. Add comprehensive logging for new features
  5. Test AI integrations with fallback mechanisms
  6. Update database schema carefully (consider migrations)
  7. Document new API endpoints

πŸ“ License

This project is open source. See LICENSE file for details.

πŸ™ Acknowledgments

  • Built with Gradio for responsive web interfaces
  • Uses Ollama for local AI inference
  • Powered by Qwen models for intelligent launch command generation
  • Enhanced with IBM Granite models for project descriptions
  • SQLite for efficient local storage and persistence
  • Threading and async patterns for responsive background processing

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published