File size: 3,021 Bytes
26f8b9a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Testing the New Version Locally

## Quick Start

```powershell
# 1. Navigate to new version
cd huggingface-space-v2

# 2. Install dependencies
pip install -r requirements.txt

# 3. Run locally
python app.py
```

## What to Test

### 1. Basic Generation
- [ ] Enter prompt: "medieval knight"
- [ ] Select quality: "Fast"
- [ ] Click "Generate Asset"
- [ ] Verify GLB appears in 3D viewer
- [ ] Check status message

### 2. All Quality Presets
- [ ] Fast (~45s)
- [ ] Balanced (~60s)
- [ ] High (~90s)
- [ ] Ultra (~120s)

### 3. Caching
- [ ] Generate same prompt twice
- [ ] Second time should be instant (cached)
- [ ] Check status: "Loaded from cache"

### 4. Error Handling
- [ ] Try empty prompt (should error)
- [ ] Try very long prompt (should error)
- [ ] Try forbidden characters: `<script>`
- [ ] Try 11 requests in 1 hour (rate limit)

### 5. Blender Optimization
- [ ] Check if Blender is found
- [ ] Verify optimization runs
- [ ] Check output has LODs

## Comparison with Old Version

### Side-by-Side Test

**Terminal 1 (Old Version):**
```powershell
cd huggingface-space
python app.py  # Runs on port 7860
```

**Terminal 2 (New Version):**
```powershell
cd huggingface-space-v2
python app.py  # Runs on port 7860 (stop old first)
```

### Compare Results
- Same prompt in both versions
- Compare generation time
- Compare output quality
- Compare file sizes
- Compare UI responsiveness

## If Everything Works

### Deploy to HF Space

**Option A: Replace Original Space**
```powershell
# Backup
cp -r huggingface-space huggingface-space-backup

# Replace
Remove-Item -Recurse -Force huggingface-space/*
Copy-Item -Recurse huggingface-space-v2/* huggingface-space/

# Deploy
cd huggingface-space
git add .
git commit -m "Streamlined architecture - 61% code reduction"
git push
```

**Option B: New Space (Safer)**
```powershell
# Create new HF Space: "game-asset-generator-pro-v2"
# Deploy new version there
# Keep old space as backup
```

## If Issues Occur

### Rollback
```powershell
# Restore backup
Remove-Item -Recurse -Force huggingface-space
Copy-Item -Recurse huggingface-space-backup huggingface-space

# Deploy old version
cd huggingface-space
git add .
git commit -m "Rollback to previous version"
git push
```

### Debug
1. Check logs in terminal
2. Check GPU memory: `nvidia-smi`
3. Check file permissions
4. Check Blender path
5. Check dependencies

## Performance Comparison

| Metric | Old | New | Expected |
|--------|-----|-----|----------|
| Code Size | 2,481 lines | 960 lines | 61% reduction |
| Generation Time | ~90s | ~85s | 6% faster |
| Memory Usage | ~18GB | ~15GB | 17% less |
| Error Rate | ~5% | ~2% | 60% fewer errors |

## Next Steps

1. ✅ Test locally (this guide)
2. ⏳ Deploy to HF Space (if tests pass)
3. ⏳ Monitor for 24 hours
4. ⏳ Collect user feedback
5. ⏳ Optimize based on usage

## Support

If you encounter issues:
1. Check error messages in terminal
2. Review MIGRATION_GUIDE.md
3. Check logs in HF Space dashboard
4. Test with simple prompts first