Spaces:
Runtime error
Runtime error
A newer version of the Gradio SDK is available:
6.1.0
Deployment Guide - New HF Space
Step 1: Create New HF Space
Fill in details:
- Space name:
game-asset-generator-pro-v2(or your choice) - License: MIT
- SDK: Gradio
- Hardware: L4 GPU (24GB VRAM)
- Visibility: Public or Private
- Space name:
Click "Create Space"
Step 2: Clone the Space Repository
# Clone your new space
git clone https://huggingface.co/spaces/YOUR_USERNAME/game-asset-generator-pro-v2
cd game-asset-generator-pro-v2
Step 3: Copy Files
# Copy all files from huggingface-space-v2
Copy-Item -Recurse D:\KIRO\Projects\XStudios\huggingface-space-v2\* .
# Verify files
Get-ChildItem -Recurse
Step 4: Configure Space
Create README.md header (HF Space metadata):
---
title: 3D Asset Generator Pro V2
emoji: ๐ฎ
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 4.44.0
app_file: app.py
pinned: false
license: mit
hardware: l4
---
Step 5: Push to HF Space
# Initialize git (if not already)
git init
# Add all files
git add .
# Commit
git commit -m "Initial deployment - Streamlined architecture"
# Add remote (if not already added)
git remote add origin https://huggingface.co/spaces/YOUR_USERNAME/game-asset-generator-pro-v2
# Push
git push -u origin main
Step 6: Monitor Deployment
- Go to your Space URL:
https://huggingface.co/spaces/YOUR_USERNAME/game-asset-generator-pro-v2 - Watch the build logs
- Wait for "Running" status (~5-10 minutes)
Step 7: Test the Space
Basic Test
- Enter prompt: "medieval knight"
- Select quality: "Fast"
- Click "Generate Asset"
- Verify 3D model appears
Full Test Suite
- All quality presets work
- Caching works (same prompt twice)
- Error handling works (invalid inputs)
- Blender optimization works
- Rate limiting works
- UI is responsive
Troubleshooting
Build Fails
Check logs for:
- Missing dependencies โ Update
requirements.txt - Import errors โ Check module structure
- Blender not found โ Verify Dockerfile
Common fixes:
# Update requirements
pip freeze > requirements.txt
# Test imports locally
python -c "from core import AssetPipeline"
Runtime Errors
Check Space logs:
- Click "Logs" tab in HF Space
- Look for error messages
- Check GPU memory usage
Common issues:
- OOM errors โ Reduce quality preset
- Timeout errors โ Increase GPU duration
- API errors โ Check Hunyuan3D Space status
Blender Not Working
Verify Blender installation:
# In Space terminal (if available)
which blender
blender --version
If missing:
- Update Dockerfile to install Blender
- Or disable Blender optimization (will skip post-processing)
Configuration Options
Environment Variables
Add to Space settings:
BLENDER_PATH=/usr/bin/blenderPYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
Hardware Settings
Recommended:
- GPU: L4 (24GB VRAM) - Optimal for FLUX + Hunyuan3D
- CPU: 8 cores
- RAM: 32GB
- Storage: 50GB
Minimum:
- GPU: T4 (16GB VRAM) - May have OOM issues
- CPU: 4 cores
- RAM: 16GB
- Storage: 20GB
Performance Tuning
If Generation is Slow
Reduce quality presets:
- Edit
core/config.py - Lower
flux_stepsandhunyuan_steps
- Edit
Disable Blender optimization:
- Comment out Blender processing in
core/pipeline.py
- Comment out Blender processing in
Increase GPU duration:
- Edit
@spaces.GPU(duration=X)decorators - Increase from 35s/90s to higher values
- Edit
If OOM Errors Occur
Enable CPU offload:
- Edit
generators/flux.py - Add
pipe.enable_sequential_cpu_offload()
- Edit
Reduce batch size:
- Lower texture resolution in presets
- Reduce octree resolution
Clear cache more frequently:
- Edit
utils/cache.py - Reduce
CACHE_EXPIRY_HOURS
- Edit
Monitoring
Check Space Health
Metrics to monitor:
- Generation success rate
- Average generation time
- GPU memory usage
- Cache hit rate
- Error rate
HF Space dashboard shows:
- Total requests
- Active users
- GPU usage
- Build status
User Feedback
Collect feedback on:
- Generation quality
- Speed/performance
- UI usability
- Error messages
- Feature requests
Maintenance
Regular Tasks
Daily:
- Check error logs
- Monitor GPU usage
- Verify cache is working
Weekly:
- Clean old cache files
- Update dependencies
- Review user feedback
Monthly:
- Update models (FLUX, Hunyuan3D)
- Optimize performance
- Add new features
Updates
To update the Space:
# Make changes locally
# Test changes
python app.py
# Commit and push
git add .
git commit -m "Update: description of changes"
git push
Comparison with Old Space
| Feature | Old Space | New Space | Status |
|---|---|---|---|
| Code Size | 2,481 lines | 960 lines | โ 61% reduction |
| Architecture | Monolithic | Modular | โ Improved |
| Type Safety | None | Full | โ Added |
| Error Handling | Basic | Comprehensive | โ Improved |
| Dependencies | 20+ | 10 | โ 50% reduction |
| Maintainability | Low | High | โ Much better |
Success Criteria
Space is successful if:
- โ Builds without errors
- โ Generates assets successfully
- โ No OOM errors
- โ Cache works (60% quota savings)
- โ UI is responsive
- โ Error messages are clear
- โ Performance is good (<90s for High quality)
Next Steps
After successful deployment:
- Share Space URL with team
- Collect user feedback
- Monitor performance for 24 hours
- Optimize based on real usage
- Consider migrating old Space if all goes well
Support
If you need help:
- Check HF Space logs
- Review error messages
- Test locally first
- Check GPU memory with
nvidia-smi - Review MIGRATION_GUIDE.md
Common resources:
- HF Spaces docs: https://huggingface.co/docs/hub/spaces
- Gradio docs: https://gradio.app/docs
- FLUX docs: https://huggingface.co/black-forest-labs/FLUX.1-dev
- Hunyuan3D docs: https://huggingface.co/tencent/Hunyuan3D-2.1