# Deployment Instructions for Hugging Face Spaces ## Prerequisites 1. A Hugging Face account (free at https://huggingface.co/join) 2. Git installed on your system 3. Hugging Face CLI (optional but recommended) ## Method 1: Deploy via Hugging Face Web Interface 1. **Create a new Space:** - Go to https://huggingface.co/new-space - Choose a name for your Space (e.g., "qwen-ocr-detection") - Select "Gradio" as the SDK - Choose "Public" or "Private" visibility - Click "Create Space" 2. **Upload files:** - Click "Files" tab in your new Space - Upload these files from the `huggingface-space` folder: - `app.py` - `requirements.txt` - `README.md` - Click "Commit changes to main" 3. **Wait for deployment:** - The Space will automatically build and deploy - Check the "App" tab to see your running application ## Method 2: Deploy via Git Command Line 1. **Install Hugging Face CLI (if not installed):** ```bash pip install huggingface_hub ``` 2. **Login to Hugging Face:** ```bash huggingface-cli login ``` Enter your Hugging Face token when prompted (get it from https://huggingface.co/settings/tokens) 3. **Create a new Space:** ```bash # Replace YOUR_USERNAME with your Hugging Face username cd /Users/sangmin/Developer/Qwen2.5-VL/huggingface-space git init git add . git commit -m "Initial commit: Qwen OCR Text Detection app" # Create the Space repository huggingface-cli repo create qwen-ocr-detection --type space --space_sdk gradio ``` 4. **Push to Hugging Face:** ```bash # Replace YOUR_USERNAME with your Hugging Face username git remote add origin https://huggingface.co/spaces/YOUR_USERNAME/qwen-ocr-detection git push -u origin main ``` ## Method 3: Manual Git Setup 1. **Create a Space on Hugging Face website** (follow Method 1, step 1) 2. **Clone the empty Space repository:** ```bash # Replace YOUR_USERNAME with your Hugging Face username git clone https://huggingface.co/spaces/YOUR_USERNAME/qwen-ocr-detection cd qwen-ocr-detection ``` 3. **Copy files and push:** ```bash cp /Users/sangmin/Developer/Qwen2.5-VL/huggingface-space/* . git add . git commit -m "Add Qwen OCR Text Detection app" git push ``` ## After Deployment 1. **Access your Space:** - URL will be: `https://huggingface.co/spaces/YOUR_USERNAME/qwen-ocr-detection` - The app should be running and accessible 2. **Share your Space:** - You can share the direct URL with others - Consider adding it to your Hugging Face profile 3. **Update the Space:** - Make changes to your local files - Commit and push changes: ```bash git add . git commit -m "Update: description of changes" git push ``` ## Troubleshooting - **Build fails:** Check the logs in the "Logs" tab of your Space - **App doesn't start:** Verify requirements.txt has correct package versions - **API key issues:** Users need their own Dashscope API key from Alibaba Cloud ## Notes - The app is configured to use the Dashscope API (Alibaba Cloud) - Users will need to provide their own API key - The free tier of Hugging Face Spaces should be sufficient for this app - Consider adding example images if needed (place in the Space repository)