#!/bin/bash # Quick deployment test - run this before pushing to HuggingFace echo "🔍 Quick Deployment Test" echo "========================" # Test 1: Python syntax check echo "" echo "1ī¸âƒŖ Checking Python syntax..." python -m py_compile app.py gemini_utils.py voucher_generator.py if [ $? -eq 0 ]; then echo " ✅ No syntax errors" else echo " ❌ Syntax errors found!" exit 1 fi # Test 2: Check imports (without running app) echo "" echo "2ī¸âƒŖ Testing imports..." python -c " import sys try: import gradio import google.genai import reportlab import pypdf import pandas from PIL import Image from dotenv import load_dotenv print(' ✅ All imports successful') except ImportError as e: print(f' ❌ Import failed: {e}') sys.exit(1) " if [ $? -ne 0 ]; then exit 1 fi # Test 3: Version compatibility echo "" echo "3ī¸âƒŖ Checking Gradio version..." python -c " import gradio as gr print(f' â„šī¸ Gradio version: {gr.__version__}') try: # Test if File component works with PDF support test = gr.File(label='test', file_types=['.pdf']) print(' ✅ Gradio File component supports PDFs') except Exception as e: print(f' ❌ Error: {e}') exit(1) " # Test 4: README metadata echo "" echo "4ī¸âƒŖ Checking README.md metadata..." if grep -q "sdk: gradio" README.md && grep -q "app_file: app.py" README.md; then echo " ✅ README.md has valid metadata" else echo " ❌ README.md missing required metadata" exit 1 fi # Test 5: Required files echo "" echo "5ī¸âƒŖ Checking required files..." required_files=("app.py" "gemini_utils.py" "voucher_generator.py" "requirements.txt" "README.md") missing=0 for file in "${required_files[@]}"; do if [ -f "$file" ]; then echo " ✅ $file exists" else echo " ❌ $file missing" missing=1 fi done if [ $missing -eq 1 ]; then exit 1 fi echo "" echo "========================" echo "🎉 All tests passed! Ready to deploy." echo "" echo "To deploy, run:" echo " git add ." echo " git commit -m 'Deploy update'" echo " git push"