Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- DEPLOYMENT_GUIDE.md +244 -0
- QUICK_START.md +143 -0
- flagged/log.csv +2 -0
- generate_requirements.py +123 -0
- gradio_outputs/motion_15795.mp4 +2 -2
- pre_deploy_check.py +266 -0
- quick_deploy.bat +49 -0
- requirements.txt +0 -0
DEPLOYMENT_GUIDE.md
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Hugging Face Deployment Guide
|
| 2 |
+
|
| 3 |
+
## The Problem
|
| 4 |
+
Your conda environment has dependencies, but Hugging Face Spaces uses pip (not conda). The current `requirements.txt` has encoding issues and missing package versions.
|
| 5 |
+
|
| 6 |
+
## Solution Overview
|
| 7 |
+
I've created scripts to:
|
| 8 |
+
1. Generate a clean requirements.txt from your conda environment
|
| 9 |
+
2. Validate all dependencies before deployment
|
| 10 |
+
3. Deploy to Hugging Face with pre-flight checks
|
| 11 |
+
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
## Step-by-Step Deployment
|
| 15 |
+
|
| 16 |
+
### Step 1: Fix requirements.txt
|
| 17 |
+
|
| 18 |
+
**Option A: Use the clean version I created (Recommended)**
|
| 19 |
+
```powershell
|
| 20 |
+
# Backup old requirements.txt
|
| 21 |
+
mv requirements.txt requirements_old.txt
|
| 22 |
+
|
| 23 |
+
# Use the clean version
|
| 24 |
+
cp requirements_hf.txt requirements.txt
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
**Option B: Generate from your conda environment**
|
| 28 |
+
```powershell
|
| 29 |
+
# Activate your conda environment
|
| 30 |
+
conda activate momask
|
| 31 |
+
|
| 32 |
+
# Generate clean requirements
|
| 33 |
+
python generate_requirements.py
|
| 34 |
+
|
| 35 |
+
# This creates requirements_clean.txt
|
| 36 |
+
# Review it, then rename to requirements.txt
|
| 37 |
+
mv requirements_clean.txt requirements.txt
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
### Step 2: Validate Everything
|
| 41 |
+
```powershell
|
| 42 |
+
# Run pre-deployment checks
|
| 43 |
+
python pre_deploy_check.py
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
This will check:
|
| 47 |
+
- Python version
|
| 48 |
+
- All required files exist
|
| 49 |
+
- Dependencies are installed
|
| 50 |
+
- requirements.txt format is correct
|
| 51 |
+
- Model checkpoints (warning if missing)
|
| 52 |
+
- README.md metadata
|
| 53 |
+
- Hugging Face token
|
| 54 |
+
- app.py syntax
|
| 55 |
+
|
| 56 |
+
**Fix any issues it reports!**
|
| 57 |
+
|
| 58 |
+
### Step 3: Set Hugging Face Token
|
| 59 |
+
```powershell
|
| 60 |
+
# Get your token from https://huggingface.co/settings/tokens
|
| 61 |
+
# It should start with "hf_"
|
| 62 |
+
|
| 63 |
+
# Set environment variable (Windows PowerShell)
|
| 64 |
+
$env:HUGGINGFACE_TOKEN = "hf_your_token_here"
|
| 65 |
+
|
| 66 |
+
# Verify it's set
|
| 67 |
+
echo $env:HUGGINGFACE_TOKEN
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
### Step 4: Update deploy.py Configuration
|
| 71 |
+
Edit `deploy.py` and update these lines:
|
| 72 |
+
```python
|
| 73 |
+
YOUR_USERNAME = "nocapdev" # Your HF username
|
| 74 |
+
SPACE_NAME = "my-gradio-momask" # Name for your space
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
### Step 5: Deploy
|
| 78 |
+
```powershell
|
| 79 |
+
# Deploy to Hugging Face
|
| 80 |
+
python deploy.py
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
The script will:
|
| 84 |
+
1. Run pre-flight checks
|
| 85 |
+
2. Validate requirements.txt
|
| 86 |
+
3. Create the Space
|
| 87 |
+
4. Upload all files
|
| 88 |
+
5. Provide the URL
|
| 89 |
+
|
| 90 |
+
### Step 6: Monitor Deployment
|
| 91 |
+
1. Go to your Space URL (shown in terminal)
|
| 92 |
+
2. Click the "Logs" tab
|
| 93 |
+
3. Watch the build process
|
| 94 |
+
4. Wait for "Running" status (2-5 minutes)
|
| 95 |
+
|
| 96 |
+
---
|
| 97 |
+
|
| 98 |
+
## Common Issues & Solutions
|
| 99 |
+
|
| 100 |
+
### Issue: "gradio not found" on Hugging Face
|
| 101 |
+
|
| 102 |
+
**Cause:** gradio is commented out in requirements.txt
|
| 103 |
+
|
| 104 |
+
**Solution:**
|
| 105 |
+
```powershell
|
| 106 |
+
# Open requirements.txt and uncomment gradio
|
| 107 |
+
# Or use the clean version I created
|
| 108 |
+
cp requirements_hf.txt requirements.txt
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
### Issue: "No module named 'clip'"
|
| 112 |
+
|
| 113 |
+
**Cause:** CLIP needs to be installed from GitHub
|
| 114 |
+
|
| 115 |
+
**Solution:**
|
| 116 |
+
```powershell
|
| 117 |
+
# Make sure requirements.txt contains:
|
| 118 |
+
git+https://github.com/openai/CLIP.git
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
### Issue: Encoding errors in requirements.txt
|
| 122 |
+
|
| 123 |
+
**Cause:** File has weird characters (��, →)
|
| 124 |
+
|
| 125 |
+
**Solution:**
|
| 126 |
+
```powershell
|
| 127 |
+
# Use the clean version
|
| 128 |
+
cp requirements_hf.txt requirements.txt
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
### Issue: Missing package versions
|
| 132 |
+
|
| 133 |
+
**Cause:** Some packages in requirements.txt don't have versions
|
| 134 |
+
|
| 135 |
+
**Solution:**
|
| 136 |
+
```powershell
|
| 137 |
+
# Run the generator to get versions
|
| 138 |
+
python generate_requirements.py
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
### Issue: "Model checkpoints not found" on Hugging Face
|
| 142 |
+
|
| 143 |
+
**Cause:** Model files are too large or not included
|
| 144 |
+
|
| 145 |
+
**Solution:** You'll need to handle models separately:
|
| 146 |
+
|
| 147 |
+
**Option 1: Download on startup**
|
| 148 |
+
Add to app.py:
|
| 149 |
+
```python
|
| 150 |
+
if not os.path.exists('./checkpoints'):
|
| 151 |
+
print("Downloading model checkpoints...")
|
| 152 |
+
# Add download logic here
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
**Option 2: Use Hugging Face Model Hub**
|
| 156 |
+
Upload models to HF Model Hub and download them in app.py:
|
| 157 |
+
```python
|
| 158 |
+
from huggingface_hub import snapshot_download
|
| 159 |
+
snapshot_download(repo_id="your-username/momask-checkpoints",
|
| 160 |
+
local_dir="./checkpoints")
|
| 161 |
+
```
|
| 162 |
+
|
| 163 |
+
### Issue: Build timeout on Hugging Face
|
| 164 |
+
|
| 165 |
+
**Cause:** Too many heavy dependencies
|
| 166 |
+
|
| 167 |
+
**Solution:**
|
| 168 |
+
- Remove unused packages from requirements.txt
|
| 169 |
+
- Use the minimal requirements_hf.txt I created
|
| 170 |
+
|
| 171 |
+
---
|
| 172 |
+
|
| 173 |
+
## File Structure Required
|
| 174 |
+
|
| 175 |
+
```
|
| 176 |
+
momaskhg/
|
| 177 |
+
├── app.py # Your Gradio app (REQUIRED)
|
| 178 |
+
├── requirements.txt # Clean pip dependencies (REQUIRED)
|
| 179 |
+
├── README.md # With HF metadata (REQUIRED)
|
| 180 |
+
├── deploy.py # Updated deployment script
|
| 181 |
+
├── pre_deploy_check.py # Validation script
|
| 182 |
+
├── generate_requirements.py # Requirements generator
|
| 183 |
+
├── requirements_hf.txt # Clean requirements template
|
| 184 |
+
└── checkpoints/ # Model files (handle separately)
|
| 185 |
+
```
|
| 186 |
+
|
| 187 |
+
---
|
| 188 |
+
|
| 189 |
+
## Quick Command Reference
|
| 190 |
+
|
| 191 |
+
```powershell
|
| 192 |
+
# 1. Fix requirements.txt
|
| 193 |
+
cp requirements_hf.txt requirements.txt
|
| 194 |
+
|
| 195 |
+
# 2. Validate everything
|
| 196 |
+
python pre_deploy_check.py
|
| 197 |
+
|
| 198 |
+
# 3. Set token
|
| 199 |
+
$env:HUGGINGFACE_TOKEN = "hf_your_token"
|
| 200 |
+
|
| 201 |
+
# 4. Deploy
|
| 202 |
+
python deploy.py
|
| 203 |
+
|
| 204 |
+
# 5. Check status
|
| 205 |
+
# Visit: https://huggingface.co/spaces/YOUR_USERNAME/SPACE_NAME
|
| 206 |
+
```
|
| 207 |
+
|
| 208 |
+
---
|
| 209 |
+
|
| 210 |
+
## What Changed in deploy.py
|
| 211 |
+
|
| 212 |
+
The updated `deploy.py` now:
|
| 213 |
+
1. ✅ Validates requirements.txt format before upload
|
| 214 |
+
2. ✅ Checks for encoding issues
|
| 215 |
+
3. ✅ Ensures critical packages (torch, gradio, numpy) are present
|
| 216 |
+
4. ✅ Verifies gradio is not commented out
|
| 217 |
+
5. ✅ Checks all required files exist
|
| 218 |
+
6. ✅ Aborts deployment if validation fails
|
| 219 |
+
|
| 220 |
+
---
|
| 221 |
+
|
| 222 |
+
## Next Steps After Successful Deployment
|
| 223 |
+
|
| 224 |
+
1. **Wait for build** (2-5 minutes)
|
| 225 |
+
2. **Check logs** for any build errors
|
| 226 |
+
3. **Test the app** with example prompts
|
| 227 |
+
4. **Add model checkpoints** if needed
|
| 228 |
+
5. **Update README.md** with usage instructions
|
| 229 |
+
|
| 230 |
+
---
|
| 231 |
+
|
| 232 |
+
## Need Help?
|
| 233 |
+
|
| 234 |
+
If deployment fails:
|
| 235 |
+
1. Check the Space logs on Hugging Face
|
| 236 |
+
2. Run `python pre_deploy_check.py` again
|
| 237 |
+
3. Make sure requirements.txt has no encoding issues
|
| 238 |
+
4. Verify all critical dependencies are listed
|
| 239 |
+
5. Check that model paths in app.py are correct
|
| 240 |
+
|
| 241 |
+
Common log errors:
|
| 242 |
+
- "Could not find a version that satisfies..." → Version conflict in requirements.txt
|
| 243 |
+
- "No module named..." → Missing dependency in requirements.txt
|
| 244 |
+
- "No such file or directory: checkpoints..." → Model files missing
|
QUICK_START.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Quick Start - Deploy to Hugging Face
|
| 2 |
+
|
| 3 |
+
## ✅ Good News!
|
| 4 |
+
Your `requirements.txt` is now **FIXED** and ready to deploy!
|
| 5 |
+
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
## 🚀 Deploy in 3 Steps
|
| 9 |
+
|
| 10 |
+
### Step 1: Set Your Hugging Face Token
|
| 11 |
+
In **PowerShell** (not Command Prompt):
|
| 12 |
+
```powershell
|
| 13 |
+
$env:HUGGINGFACE_TOKEN = "hf_your_token_here"
|
| 14 |
+
```
|
| 15 |
+
|
| 16 |
+
Get your token from: https://huggingface.co/settings/tokens
|
| 17 |
+
|
| 18 |
+
### Step 2: Run Validation
|
| 19 |
+
```powershell
|
| 20 |
+
python pre_deploy_check.py
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
This should show **8/8 PASS** if everything is ready.
|
| 24 |
+
|
| 25 |
+
### Step 3: Deploy
|
| 26 |
+
```powershell
|
| 27 |
+
python deploy.py
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
That's it! Your Space will be live in 2-5 minutes.
|
| 31 |
+
|
| 32 |
+
---
|
| 33 |
+
|
| 34 |
+
## 🎯 One-Command Deploy (Alternative)
|
| 35 |
+
|
| 36 |
+
If you prefer, use the batch script:
|
| 37 |
+
|
| 38 |
+
```powershell
|
| 39 |
+
# 1. Set token first
|
| 40 |
+
$env:HUGGINGFACE_TOKEN = "hf_your_token"
|
| 41 |
+
|
| 42 |
+
# 2. Run quick deploy (does validation + deployment)
|
| 43 |
+
.\quick_deploy.bat
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
---
|
| 47 |
+
|
| 48 |
+
## 📊 What Just Got Fixed
|
| 49 |
+
|
| 50 |
+
| Issue | Status |
|
| 51 |
+
|-------|--------|
|
| 52 |
+
| Encoding issues (��, →) | ✅ Fixed |
|
| 53 |
+
| Missing gradio version | ✅ Fixed |
|
| 54 |
+
| Gradio commented out | ✅ Fixed |
|
| 55 |
+
| Missing torch version | ✅ Fixed |
|
| 56 |
+
| requirements.txt validation | ✅ Now passes |
|
| 57 |
+
|
| 58 |
+
---
|
| 59 |
+
|
| 60 |
+
## ⚙️ Configuration
|
| 61 |
+
|
| 62 |
+
Before deploying, update these in [deploy.py](deploy.py):
|
| 63 |
+
|
| 64 |
+
```python
|
| 65 |
+
YOUR_USERNAME = "nocapdev" # Your HF username
|
| 66 |
+
SPACE_NAME = "my-gradio-momask" # Name for your space
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
---
|
| 70 |
+
|
| 71 |
+
## 🔍 Check Your Deployment
|
| 72 |
+
|
| 73 |
+
After running `python deploy.py`, you'll see:
|
| 74 |
+
|
| 75 |
+
```
|
| 76 |
+
✓ SUCCESS!
|
| 77 |
+
📍 Space URL: https://huggingface.co/spaces/YOUR_USERNAME/SPACE_NAME
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
Visit that URL and:
|
| 81 |
+
1. Click "Logs" tab
|
| 82 |
+
2. Watch the build (takes 2-5 minutes)
|
| 83 |
+
3. Wait for "Running" status
|
| 84 |
+
4. Test your app!
|
| 85 |
+
|
| 86 |
+
---
|
| 87 |
+
|
| 88 |
+
## 🆘 If Something Goes Wrong
|
| 89 |
+
|
| 90 |
+
### Token not recognized
|
| 91 |
+
```powershell
|
| 92 |
+
# Check if it's set
|
| 93 |
+
echo $env:HUGGINGFACE_TOKEN
|
| 94 |
+
|
| 95 |
+
# Re-set it
|
| 96 |
+
$env:HUGGINGFACE_TOKEN = "hf_your_token"
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
### Pre-deployment check fails
|
| 100 |
+
```powershell
|
| 101 |
+
# Run it to see specific issues
|
| 102 |
+
python pre_deploy_check.py
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
### Build fails on Hugging Face
|
| 106 |
+
- Check the "Logs" tab on your Space
|
| 107 |
+
- Most common: missing dependencies
|
| 108 |
+
- Solution: Your requirements.txt is already fixed!
|
| 109 |
+
|
| 110 |
+
### "No module named 'clip'" error
|
| 111 |
+
- This should be fixed (requirements.txt has CLIP from GitHub)
|
| 112 |
+
- If still fails, check HF logs for the specific error
|
| 113 |
+
|
| 114 |
+
---
|
| 115 |
+
|
| 116 |
+
## 📁 Files You Now Have
|
| 117 |
+
|
| 118 |
+
| File | Purpose |
|
| 119 |
+
|------|---------|
|
| 120 |
+
| `requirements.txt` | ✅ Fixed dependencies (ready to use) |
|
| 121 |
+
| `deploy.py` | ✅ Updated with validation |
|
| 122 |
+
| `pre_deploy_check.py` | ✅ Validates before deploy |
|
| 123 |
+
| `quick_deploy.bat` | ✅ One-click deployment |
|
| 124 |
+
| `generate_requirements.py` | Tool to regenerate requirements |
|
| 125 |
+
| `DEPLOYMENT_GUIDE.md` | Detailed troubleshooting |
|
| 126 |
+
| `QUICK_START.md` | This file |
|
| 127 |
+
|
| 128 |
+
---
|
| 129 |
+
|
| 130 |
+
## 🎉 Ready to Deploy?
|
| 131 |
+
|
| 132 |
+
```powershell
|
| 133 |
+
# 1. Set token
|
| 134 |
+
$env:HUGGINGFACE_TOKEN = "hf_your_token"
|
| 135 |
+
|
| 136 |
+
# 2. Validate
|
| 137 |
+
python pre_deploy_check.py
|
| 138 |
+
|
| 139 |
+
# 3. Deploy
|
| 140 |
+
python deploy.py
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
Your Space will be live soon! 🚀
|
flagged/log.csv
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Motion Description,Generated Motion,flag,username,timestamp
|
| 2 |
+
,,,,2025-11-27 23:02:56.424322
|
generate_requirements.py
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Generate clean requirements.txt from conda environment for Hugging Face deployment
|
| 3 |
+
"""
|
| 4 |
+
import subprocess
|
| 5 |
+
import sys
|
| 6 |
+
import re
|
| 7 |
+
|
| 8 |
+
def get_conda_packages():
|
| 9 |
+
"""Get packages from conda environment"""
|
| 10 |
+
print("Getting packages from conda environment 'momask'...")
|
| 11 |
+
try:
|
| 12 |
+
result = subprocess.run(
|
| 13 |
+
['conda', 'list', '-n', 'momask', '--export'],
|
| 14 |
+
capture_output=True,
|
| 15 |
+
text=True,
|
| 16 |
+
check=True
|
| 17 |
+
)
|
| 18 |
+
return result.stdout
|
| 19 |
+
except subprocess.CalledProcessError as e:
|
| 20 |
+
print(f"Error getting conda packages: {e}")
|
| 21 |
+
return None
|
| 22 |
+
|
| 23 |
+
def convert_to_pip_format(conda_output):
|
| 24 |
+
"""Convert conda export to pip requirements format"""
|
| 25 |
+
requirements = []
|
| 26 |
+
|
| 27 |
+
for line in conda_output.split('\n'):
|
| 28 |
+
line = line.strip()
|
| 29 |
+
# Skip comments and empty lines
|
| 30 |
+
if not line or line.startswith('#'):
|
| 31 |
+
continue
|
| 32 |
+
|
| 33 |
+
# Parse conda format: package=version=build
|
| 34 |
+
parts = line.split('=')
|
| 35 |
+
if len(parts) >= 2:
|
| 36 |
+
package = parts[0]
|
| 37 |
+
version = parts[1]
|
| 38 |
+
|
| 39 |
+
# Skip pip itself and conda-specific packages
|
| 40 |
+
if package in ['pip', 'conda', 'python']:
|
| 41 |
+
continue
|
| 42 |
+
|
| 43 |
+
# Handle special cases
|
| 44 |
+
if package == 'pytorch':
|
| 45 |
+
package = 'torch'
|
| 46 |
+
elif package == 'pytorch-cuda':
|
| 47 |
+
continue # Skip CUDA packages
|
| 48 |
+
|
| 49 |
+
requirements.append(f"{package}=={version}")
|
| 50 |
+
|
| 51 |
+
return requirements
|
| 52 |
+
|
| 53 |
+
def create_minimal_requirements():
|
| 54 |
+
"""Create minimal requirements.txt with essential packages"""
|
| 55 |
+
print("\nCreating minimal requirements.txt with essential packages...")
|
| 56 |
+
|
| 57 |
+
essential_packages = [
|
| 58 |
+
"torch>=2.0.0",
|
| 59 |
+
"torchvision>=0.15.0",
|
| 60 |
+
"torchaudio>=2.0.0",
|
| 61 |
+
"numpy==1.23.5",
|
| 62 |
+
"gradio>=4.0.0",
|
| 63 |
+
"einops>=0.6.1",
|
| 64 |
+
"scipy>=1.13.0",
|
| 65 |
+
"matplotlib>=3.5.0",
|
| 66 |
+
"trimesh>=4.0.0",
|
| 67 |
+
"chumpy>=0.70",
|
| 68 |
+
"scikit-learn>=1.6.0",
|
| 69 |
+
"tqdm>=4.67.0",
|
| 70 |
+
"pandas>=2.0.0",
|
| 71 |
+
"Pillow>=9.0.0",
|
| 72 |
+
"ffmpeg-python>=0.2.0",
|
| 73 |
+
"vector-quantize-pytorch>=1.6.0",
|
| 74 |
+
"huggingface-hub>=1.0.0",
|
| 75 |
+
"git+https://github.com/openai/CLIP.git",
|
| 76 |
+
]
|
| 77 |
+
|
| 78 |
+
return essential_packages
|
| 79 |
+
|
| 80 |
+
def main():
|
| 81 |
+
print("=" * 70)
|
| 82 |
+
print(" " * 20 + "Requirements Generator")
|
| 83 |
+
print("=" * 70)
|
| 84 |
+
|
| 85 |
+
# Try to get packages from conda
|
| 86 |
+
conda_output = get_conda_packages()
|
| 87 |
+
|
| 88 |
+
if conda_output:
|
| 89 |
+
print("✓ Successfully retrieved conda packages")
|
| 90 |
+
requirements = convert_to_pip_format(conda_output)
|
| 91 |
+
print(f"✓ Found {len(requirements)} packages")
|
| 92 |
+
else:
|
| 93 |
+
print("⚠ Could not retrieve conda packages, using minimal requirements")
|
| 94 |
+
requirements = create_minimal_requirements()
|
| 95 |
+
|
| 96 |
+
# Always ensure essential packages are included
|
| 97 |
+
essential_packages = create_minimal_requirements()
|
| 98 |
+
|
| 99 |
+
# Write requirements.txt
|
| 100 |
+
output_file = 'requirements_clean.txt'
|
| 101 |
+
print(f"\nWriting to {output_file}...")
|
| 102 |
+
|
| 103 |
+
with open(output_file, 'w', encoding='utf-8') as f:
|
| 104 |
+
# Write header
|
| 105 |
+
f.write("# Requirements for Hugging Face Spaces deployment\n")
|
| 106 |
+
f.write("# Generated for MoMask Text-to-Motion Generator\n\n")
|
| 107 |
+
|
| 108 |
+
# Write essential packages
|
| 109 |
+
f.write("# Essential packages\n")
|
| 110 |
+
for pkg in essential_packages:
|
| 111 |
+
f.write(f"{pkg}\n")
|
| 112 |
+
|
| 113 |
+
print(f"✓ Requirements written to {output_file}")
|
| 114 |
+
print("\nNext steps:")
|
| 115 |
+
print("1. Review requirements_clean.txt")
|
| 116 |
+
print("2. Rename it to requirements.txt")
|
| 117 |
+
print("3. Test locally: pip install -r requirements.txt")
|
| 118 |
+
print("4. Run pre_deploy_check.py before deploying")
|
| 119 |
+
|
| 120 |
+
print("\n" + "=" * 70)
|
| 121 |
+
|
| 122 |
+
if __name__ == "__main__":
|
| 123 |
+
main()
|
gradio_outputs/motion_15795.mp4
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7205b2a90f0947dc7254d87aae236a7eb62344230188c7b558b71717c970577d
|
| 3 |
+
size 137489
|
pre_deploy_check.py
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Pre-deployment validation script for Hugging Face Spaces
|
| 3 |
+
Checks all dependencies and files before deployment
|
| 4 |
+
"""
|
| 5 |
+
import os
|
| 6 |
+
import sys
|
| 7 |
+
import subprocess
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
import importlib.util
|
| 10 |
+
|
| 11 |
+
# Fix Windows encoding issues
|
| 12 |
+
if sys.platform == 'win32':
|
| 13 |
+
import io
|
| 14 |
+
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
| 15 |
+
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
| 16 |
+
|
| 17 |
+
class Colors:
|
| 18 |
+
GREEN = '\033[92m'
|
| 19 |
+
RED = '\033[91m'
|
| 20 |
+
YELLOW = '\033[93m'
|
| 21 |
+
BLUE = '\033[94m'
|
| 22 |
+
RESET = '\033[0m'
|
| 23 |
+
|
| 24 |
+
def print_success(msg):
|
| 25 |
+
print(f"{Colors.GREEN}✓{Colors.RESET} {msg}")
|
| 26 |
+
|
| 27 |
+
def print_error(msg):
|
| 28 |
+
print(f"{Colors.RED}✗{Colors.RESET} {msg}")
|
| 29 |
+
|
| 30 |
+
def print_warning(msg):
|
| 31 |
+
print(f"{Colors.YELLOW}⚠{Colors.RESET} {msg}")
|
| 32 |
+
|
| 33 |
+
def print_info(msg):
|
| 34 |
+
print(f"{Colors.BLUE}ℹ{Colors.RESET} {msg}")
|
| 35 |
+
|
| 36 |
+
def check_python_version():
|
| 37 |
+
"""Check Python version"""
|
| 38 |
+
print("\n[1/8] Checking Python version...")
|
| 39 |
+
version = sys.version_info
|
| 40 |
+
if version.major == 3 and version.minor >= 8:
|
| 41 |
+
print_success(f"Python {version.major}.{version.minor}.{version.micro}")
|
| 42 |
+
return True
|
| 43 |
+
else:
|
| 44 |
+
print_error(f"Python {version.major}.{version.minor}.{version.micro} - Requires Python 3.8+")
|
| 45 |
+
return False
|
| 46 |
+
|
| 47 |
+
def check_required_files():
|
| 48 |
+
"""Check for required files"""
|
| 49 |
+
print("\n[2/8] Checking required files...")
|
| 50 |
+
required_files = {
|
| 51 |
+
'app.py': 'Main application file',
|
| 52 |
+
'requirements.txt': 'Dependencies list',
|
| 53 |
+
'README.md': 'Space documentation'
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
all_found = True
|
| 57 |
+
for file, description in required_files.items():
|
| 58 |
+
if Path(file).exists():
|
| 59 |
+
print_success(f"{file:<20} - {description}")
|
| 60 |
+
else:
|
| 61 |
+
print_error(f"{file:<20} - MISSING ({description})")
|
| 62 |
+
all_found = False
|
| 63 |
+
|
| 64 |
+
return all_found
|
| 65 |
+
|
| 66 |
+
def check_dependencies():
|
| 67 |
+
"""Check if all dependencies can be imported"""
|
| 68 |
+
print("\n[3/8] Checking critical dependencies...")
|
| 69 |
+
|
| 70 |
+
critical_deps = {
|
| 71 |
+
'torch': 'PyTorch',
|
| 72 |
+
'gradio': 'Gradio',
|
| 73 |
+
'numpy': 'NumPy',
|
| 74 |
+
'einops': 'Einops',
|
| 75 |
+
'scipy': 'SciPy',
|
| 76 |
+
'matplotlib': 'Matplotlib',
|
| 77 |
+
'trimesh': 'Trimesh',
|
| 78 |
+
'sklearn': 'Scikit-learn',
|
| 79 |
+
'clip': 'OpenAI CLIP',
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
all_installed = True
|
| 83 |
+
for module, name in critical_deps.items():
|
| 84 |
+
try:
|
| 85 |
+
__import__(module)
|
| 86 |
+
print_success(f"{name:<20}")
|
| 87 |
+
except ImportError:
|
| 88 |
+
print_error(f"{name:<20} - NOT INSTALLED")
|
| 89 |
+
all_installed = False
|
| 90 |
+
|
| 91 |
+
return all_installed
|
| 92 |
+
|
| 93 |
+
def check_requirements_txt():
|
| 94 |
+
"""Validate requirements.txt format"""
|
| 95 |
+
print("\n[4/8] Validating requirements.txt...")
|
| 96 |
+
|
| 97 |
+
if not Path('requirements.txt').exists():
|
| 98 |
+
print_error("requirements.txt not found")
|
| 99 |
+
return False
|
| 100 |
+
|
| 101 |
+
with open('requirements.txt', 'r', encoding='utf-8') as f:
|
| 102 |
+
content = f.read()
|
| 103 |
+
|
| 104 |
+
issues = []
|
| 105 |
+
|
| 106 |
+
# Check for encoding issues
|
| 107 |
+
if '��' in content or '→' in content:
|
| 108 |
+
issues.append("File has encoding issues (contains weird characters)")
|
| 109 |
+
|
| 110 |
+
# Check for missing versions
|
| 111 |
+
lines = content.split('\n')
|
| 112 |
+
missing_versions = []
|
| 113 |
+
for line in lines:
|
| 114 |
+
line = line.strip()
|
| 115 |
+
if line and not line.startswith('#'):
|
| 116 |
+
if '==' not in line and '>=' not in line and not line.startswith('git+'):
|
| 117 |
+
missing_versions.append(line)
|
| 118 |
+
|
| 119 |
+
if missing_versions:
|
| 120 |
+
issues.append(f"Packages without version: {', '.join(missing_versions[:5])}")
|
| 121 |
+
|
| 122 |
+
# Check for commented critical packages (only check actual package lines, not section headers)
|
| 123 |
+
lines_lower = [line.strip().lower() for line in lines if line.strip() and not line.strip().startswith('#')]
|
| 124 |
+
has_gradio = any('gradio' in line for line in lines_lower)
|
| 125 |
+
|
| 126 |
+
if not has_gradio:
|
| 127 |
+
# Check if it's commented out in package lines
|
| 128 |
+
commented_lines = [line.strip().lower() for line in lines if line.strip().startswith('#')]
|
| 129 |
+
if any(line.startswith('# gradio==') or line.startswith('# gradio>=') or line.startswith('#gradio') for line in commented_lines):
|
| 130 |
+
issues.append("gradio is commented out")
|
| 131 |
+
|
| 132 |
+
if issues:
|
| 133 |
+
for issue in issues:
|
| 134 |
+
print_error(issue)
|
| 135 |
+
return False
|
| 136 |
+
else:
|
| 137 |
+
print_success("requirements.txt is valid")
|
| 138 |
+
return True
|
| 139 |
+
|
| 140 |
+
def check_model_paths():
|
| 141 |
+
"""Check if model checkpoint paths exist"""
|
| 142 |
+
print("\n[5/8] Checking model checkpoints...")
|
| 143 |
+
|
| 144 |
+
checkpoints_dir = './checkpoints'
|
| 145 |
+
if not Path(checkpoints_dir).exists():
|
| 146 |
+
print_error(f"Checkpoints directory not found: {checkpoints_dir}")
|
| 147 |
+
return False
|
| 148 |
+
|
| 149 |
+
dataset_name = 't2m'
|
| 150 |
+
required_paths = [
|
| 151 |
+
f'{checkpoints_dir}/{dataset_name}/t2m_nlayer8_nhead6_ld384_ff1024_cdp0.1_rvq6ns',
|
| 152 |
+
f'{checkpoints_dir}/{dataset_name}/rvq_nq6_dc512_nc512_noshare_qdp0.2',
|
| 153 |
+
f'{checkpoints_dir}/{dataset_name}/length_estimator',
|
| 154 |
+
]
|
| 155 |
+
|
| 156 |
+
all_found = True
|
| 157 |
+
for path in required_paths:
|
| 158 |
+
if Path(path).exists():
|
| 159 |
+
print_success(f"Found: {Path(path).name}")
|
| 160 |
+
else:
|
| 161 |
+
print_warning(f"Missing: {path}")
|
| 162 |
+
all_found = False
|
| 163 |
+
|
| 164 |
+
if not all_found:
|
| 165 |
+
print_warning("Some checkpoints are missing - you'll need to download them")
|
| 166 |
+
|
| 167 |
+
return True # Don't fail on missing checkpoints as they might be downloaded later
|
| 168 |
+
|
| 169 |
+
def check_readme():
|
| 170 |
+
"""Check README.md content"""
|
| 171 |
+
print("\n[6/8] Checking README.md...")
|
| 172 |
+
|
| 173 |
+
if not Path('README.md').exists():
|
| 174 |
+
print_warning("README.md not found")
|
| 175 |
+
return False
|
| 176 |
+
|
| 177 |
+
with open('README.md', 'r', encoding='utf-8') as f:
|
| 178 |
+
content = f.read()
|
| 179 |
+
|
| 180 |
+
required_sections = ['title:', 'sdk:', 'sdk_version:']
|
| 181 |
+
missing = [s for s in required_sections if s.lower() not in content.lower()]
|
| 182 |
+
|
| 183 |
+
if missing:
|
| 184 |
+
print_warning(f"README.md missing metadata: {', '.join(missing)}")
|
| 185 |
+
print_info("Add YAML frontmatter for Hugging Face Spaces")
|
| 186 |
+
return False
|
| 187 |
+
else:
|
| 188 |
+
print_success("README.md has required metadata")
|
| 189 |
+
return True
|
| 190 |
+
|
| 191 |
+
def check_huggingface_token():
|
| 192 |
+
"""Check if Hugging Face token is set"""
|
| 193 |
+
print("\n[7/8] Checking Hugging Face token...")
|
| 194 |
+
|
| 195 |
+
token = os.getenv('HUGGINGFACE_TOKEN')
|
| 196 |
+
if token:
|
| 197 |
+
print_success("HUGGINGFACE_TOKEN environment variable is set")
|
| 198 |
+
return True
|
| 199 |
+
else:
|
| 200 |
+
print_error("HUGGINGFACE_TOKEN not set")
|
| 201 |
+
print_info("Set with: $env:HUGGINGFACE_TOKEN = 'hf_your_token'")
|
| 202 |
+
return False
|
| 203 |
+
|
| 204 |
+
def check_app_syntax():
|
| 205 |
+
"""Check if app.py has valid Python syntax"""
|
| 206 |
+
print("\n[8/8] Checking app.py syntax...")
|
| 207 |
+
|
| 208 |
+
try:
|
| 209 |
+
with open('app.py', 'r', encoding='utf-8') as f:
|
| 210 |
+
compile(f.read(), 'app.py', 'exec')
|
| 211 |
+
print_success("app.py has valid syntax")
|
| 212 |
+
return True
|
| 213 |
+
except SyntaxError as e:
|
| 214 |
+
print_error(f"Syntax error in app.py: {e}")
|
| 215 |
+
return False
|
| 216 |
+
|
| 217 |
+
def main():
|
| 218 |
+
print("=" * 70)
|
| 219 |
+
print(" " * 18 + "Pre-Deployment Validation")
|
| 220 |
+
print("=" * 70)
|
| 221 |
+
|
| 222 |
+
checks = [
|
| 223 |
+
("Python Version", check_python_version),
|
| 224 |
+
("Required Files", check_required_files),
|
| 225 |
+
("Dependencies", check_dependencies),
|
| 226 |
+
("Requirements.txt", check_requirements_txt),
|
| 227 |
+
("Model Paths", check_model_paths),
|
| 228 |
+
("README.md", check_readme),
|
| 229 |
+
("HF Token", check_huggingface_token),
|
| 230 |
+
("App Syntax", check_app_syntax),
|
| 231 |
+
]
|
| 232 |
+
|
| 233 |
+
results = {}
|
| 234 |
+
for name, check_func in checks:
|
| 235 |
+
try:
|
| 236 |
+
results[name] = check_func()
|
| 237 |
+
except Exception as e:
|
| 238 |
+
print_error(f"Check failed with error: {e}")
|
| 239 |
+
results[name] = False
|
| 240 |
+
|
| 241 |
+
# Summary
|
| 242 |
+
print("\n" + "=" * 70)
|
| 243 |
+
print(" " * 25 + "SUMMARY")
|
| 244 |
+
print("=" * 70)
|
| 245 |
+
|
| 246 |
+
passed = sum(1 for v in results.values() if v)
|
| 247 |
+
total = len(results)
|
| 248 |
+
|
| 249 |
+
for name, result in results.items():
|
| 250 |
+
status = f"{Colors.GREEN}PASS{Colors.RESET}" if result else f"{Colors.RED}FAIL{Colors.RESET}"
|
| 251 |
+
print(f"{name:<30} {status}")
|
| 252 |
+
|
| 253 |
+
print("=" * 70)
|
| 254 |
+
print(f"\nPassed: {passed}/{total}")
|
| 255 |
+
|
| 256 |
+
if passed == total:
|
| 257 |
+
print_success("\n✓ All checks passed! Ready to deploy.")
|
| 258 |
+
print_info("\nRun: python deploy.py")
|
| 259 |
+
return 0
|
| 260 |
+
else:
|
| 261 |
+
print_error("\n✗ Some checks failed. Fix issues before deploying.")
|
| 262 |
+
print_info("\nFix the issues above and run this script again.")
|
| 263 |
+
return 1
|
| 264 |
+
|
| 265 |
+
if __name__ == "__main__":
|
| 266 |
+
sys.exit(main())
|
quick_deploy.bat
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
echo ======================================================================
|
| 3 |
+
echo Quick Deploy to Hugging Face
|
| 4 |
+
echo ======================================================================
|
| 5 |
+
echo.
|
| 6 |
+
|
| 7 |
+
REM Check if token is set
|
| 8 |
+
if "%HUGGINGFACE_TOKEN%"=="" (
|
| 9 |
+
echo ERROR: HUGGINGFACE_TOKEN not set!
|
| 10 |
+
echo.
|
| 11 |
+
echo Please run this in PowerShell:
|
| 12 |
+
echo $env:HUGGINGFACE_TOKEN = "hf_your_token_here"
|
| 13 |
+
echo.
|
| 14 |
+
echo Then run this script again.
|
| 15 |
+
pause
|
| 16 |
+
exit /b 1
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
echo [Step 1/3] Running pre-deployment checks...
|
| 20 |
+
echo.
|
| 21 |
+
python pre_deploy_check.py
|
| 22 |
+
if errorlevel 1 (
|
| 23 |
+
echo.
|
| 24 |
+
echo Pre-deployment checks FAILED!
|
| 25 |
+
echo Fix the issues above before deploying.
|
| 26 |
+
pause
|
| 27 |
+
exit /b 1
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
echo.
|
| 31 |
+
echo ======================================================================
|
| 32 |
+
echo [Step 2/3] All checks passed! Ready to deploy.
|
| 33 |
+
echo ======================================================================
|
| 34 |
+
echo.
|
| 35 |
+
set /p CONFIRM="Do you want to continue with deployment? (yes/no): "
|
| 36 |
+
|
| 37 |
+
if /i not "%CONFIRM%"=="yes" if /i not "%CONFIRM%"=="y" (
|
| 38 |
+
echo.
|
| 39 |
+
echo Deployment cancelled.
|
| 40 |
+
pause
|
| 41 |
+
exit /b 0
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
echo.
|
| 45 |
+
echo [Step 3/3] Deploying to Hugging Face...
|
| 46 |
+
echo.
|
| 47 |
+
python deploy.py
|
| 48 |
+
|
| 49 |
+
pause
|
requirements.txt
CHANGED
|
Binary files a/requirements.txt and b/requirements.txt differ
|
|
|