Spaces:
Build error
Build error
| #!/usr/bin/env python3 | |
| """ | |
| Quick setup script for ColPali-Vespa Visual Retrieval System | |
| """ | |
| import os | |
| import sys | |
| from pathlib import Path | |
| def create_env_file(): | |
| """Create a sample .env file if it doesn't exist""" | |
| env_path = Path(".env") | |
| if env_path.exists(): | |
| print("β .env file already exists") | |
| return | |
| env_content = """# Vespa Configuration | |
| # Choose one authentication method: | |
| # Option 1: Token Authentication (Recommended) | |
| VESPA_APP_TOKEN_URL=https://your-app.your-tenant.vespa-cloud.com | |
| VESPA_CLOUD_SECRET_TOKEN=your_vespa_secret_token_here | |
| # Option 2: mTLS Authentication | |
| # USE_MTLS=true | |
| # VESPA_APP_MTLS_URL=https://your-app.your-tenant.vespa-cloud.com | |
| # VESPA_CLOUD_MTLS_KEY="-----BEGIN PRIVATE KEY----- | |
| # Your private key content here | |
| # -----END PRIVATE KEY-----" | |
| # VESPA_CLOUD_MTLS_CERT="-----BEGIN CERTIFICATE----- | |
| # Your certificate content here | |
| # -----END CERTIFICATE-----" | |
| # Google Gemini Configuration (Optional - for AI chat features) | |
| GEMINI_API_KEY=your_gemini_api_key_here | |
| # Application Configuration | |
| LOG_LEVEL=INFO | |
| HOT_RELOAD=false | |
| # Development Configuration | |
| # Uncomment for development mode | |
| # HOT_RELOAD=true | |
| # LOG_LEVEL=DEBUG | |
| """ | |
| with open(env_path, "w") as f: | |
| f.write(env_content) | |
| print("β Created .env file with sample configuration") | |
| print(" Please edit .env with your actual credentials") | |
| def create_directories(): | |
| """Create necessary directories""" | |
| directories = ["static", "static/full_images", "static/sim_maps"] | |
| for directory in directories: | |
| Path(directory).mkdir(parents=True, exist_ok=True) | |
| print("β Created necessary directories") | |
| def check_python_version(): | |
| """Check if Python version is compatible""" | |
| version = sys.version_info | |
| if version.major != 3 or version.minor < 10 or version.minor >= 13: | |
| print("β Python 3.10, 3.11, or 3.12 is required") | |
| print(f" Current version: {version.major}.{version.minor}.{version.micro}") | |
| return False | |
| print( | |
| f"β Python version {version.major}.{version.minor}.{version.micro} is compatible" | |
| ) | |
| return True | |
| def main(): | |
| """Main setup function""" | |
| print("π ColPali-Vespa Visual Retrieval Setup") | |
| print("=" * 40) | |
| # Check Python version | |
| if not check_python_version(): | |
| sys.exit(1) | |
| # Create directories | |
| create_directories() | |
| # Create .env file | |
| create_env_file() | |
| print("\nπ Next steps:") | |
| print("1. Edit .env file with your Vespa and Gemini credentials") | |
| print("2. Install dependencies: pip install -e .") | |
| print("3. Deploy Vespa application: python deploy_vespa_app.py ...") | |
| print("4. Upload documents: python feed_vespa.py ...") | |
| print("5. Run the application: python main.py") | |
| print("\nπ See README.md for detailed instructions") | |
| if __name__ == "__main__": | |
| main() | |