Xernive's picture
fix: revert to API client with better error handling (Hunyuan3D not pip-installable)
26f8b9a

A newer version of the Gradio SDK is available: 6.1.0

Upgrade

Pre-Deployment Checklist

โœ… Files Ready

  • app.py - Clean Gradio UI (150 lines)
  • requirements.txt - Minimal dependencies (10 packages)
  • Dockerfile - HF Space configuration
  • .gitignore - Ignore temp files
  • README.md - Documentation
  • core/ - Pipeline orchestration
  • generators/ - FLUX + Hunyuan3D
  • processors/ - Blender + Validator
  • utils/ - Cache + Security + Memory
  • scripts/ - External Blender script

๐Ÿ“‹ Pre-Deployment Steps

1. Local Testing (Optional but Recommended)

cd huggingface-space-v2
pip install -r requirements.txt
python app.py

Test:

  • App launches without errors
  • UI loads correctly
  • Can enter prompt
  • Can select quality
  • Generate button works

2. Create New HF Space

Go to: https://huggingface.co/new-space

Settings:

  • Space name: game-asset-generator-pro-v2 (or your choice)
  • License: MIT
  • SDK: Gradio
  • SDK Version: 4.44.0
  • Hardware: L4 GPU (24GB VRAM)
  • Visibility: Public or Private

3. Clone Space Repository

git clone https://huggingface.co/spaces/YOUR_USERNAME/SPACE_NAME
cd SPACE_NAME

4. Copy Files

Option A: Manual Copy

Copy-Item -Recurse D:\KIRO\Projects\XStudios\huggingface-space-v2\* .

Option B: Use Script

cd D:\KIRO\Projects\XStudios\huggingface-space-v2
.\QUICK_DEPLOY.ps1 -SpaceURL "https://huggingface.co/spaces/YOUR_USERNAME/SPACE_NAME"

5. Verify Files

Get-ChildItem -Recurse

Should see:

  • app.py
  • requirements.txt
  • Dockerfile
  • .gitignore
  • README.md (with HF metadata header)
  • core/ directory
  • generators/ directory
  • processors/ directory
  • utils/ directory
  • scripts/ directory

6. Update README Header

Ensure README.md starts with: ```yaml

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


### 7. Push to HF Space

```powershell
git add .
git commit -m "Initial deployment - Streamlined architecture"
git push

8. Monitor Build

  1. Go to Space URL
  2. Watch build logs
  3. Wait for "Running" status (~5-10 minutes)

Build should:

  • Install dependencies
  • Install Blender
  • Start Gradio app
  • Show "Running" status

๐Ÿงช Post-Deployment Testing

Basic Functionality

  1. Open Space URL

    • UI loads correctly
    • No console errors
  2. Test Generation (Fast)

    • Prompt: "medieval knight"
    • Quality: Fast
    • Click Generate
    • Wait ~45 seconds
    • 3D model appears
    • Status shows success
  3. Test Caching

    • Same prompt again
    • Should be instant
    • Status: "Loaded from cache"
  4. Test Quality Presets

    • Fast (~45s)
    • Balanced (~60s)
    • High (~90s)
    • Ultra (~120s)

Error Handling

  1. Test Invalid Inputs

    • Empty prompt โ†’ Error message
    • Very long prompt โ†’ Error message
    • Forbidden chars <script> โ†’ Error message
  2. Test Rate Limiting

    • Make 11 requests quickly
    • 11th should be rate limited

Advanced Features

  1. Test Blender Optimization

    • Check logs for "Blender found"
    • Verify optimization runs
    • Check output file size
  2. Test Examples

    • Click example prompts
    • Verify they work

๐Ÿ“Š Performance Metrics

After 1 hour of testing:

  • Generation success rate: >95%
  • Average generation time: <90s (High quality)
  • Cache hit rate: >50%
  • Error rate: <5%
  • GPU memory usage: <20GB
  • No OOM errors

๐Ÿ› Troubleshooting

Build Fails

Check:

  • requirements.txt has all dependencies
  • Dockerfile syntax is correct
  • No import errors in code

Fix:

# Test locally first
pip install -r requirements.txt
python app.py

Runtime Errors

Check Space logs:

  • Click "Logs" tab
  • Look for error messages
  • Check GPU memory usage

Common issues:

  • OOM โ†’ Reduce quality presets
  • Timeout โ†’ Increase GPU duration
  • API errors โ†’ Check Hunyuan3D status

Blender Not Working

Check:

  • Dockerfile installs Blender
  • BLENDER_PATH is set correctly
  • Blender script is executable

Fallback:

  • Space will work without Blender
  • Just skips optimization step

โœจ Success Criteria

Space is successful if:

  • โœ… Builds without errors
  • โœ… UI loads correctly
  • โœ… Generates assets successfully
  • โœ… Caching works
  • โœ… No OOM errors
  • โœ… Performance is good
  • โœ… Error messages are clear

๐Ÿ“ˆ Next Steps

After successful deployment:

  1. Share Space

    • Share URL with team
    • Add to project documentation
  2. Monitor Performance

    • Check daily for 1 week
    • Review error logs
    • Collect user feedback
  3. Optimize

    • Adjust quality presets if needed
    • Tune cache settings
    • Add features based on feedback
  4. Consider Migration

    • If all goes well for 1 week
    • Migrate old Space to new architecture
    • Or keep both running

๐ŸŽ‰ Deployment Complete!

Once all checkboxes are โœ…, your new Space is ready!

Space URL: https://huggingface.co/spaces/YOUR_USERNAME/SPACE_NAME

Key Features:

  • 61% less code (2,481 โ†’ 960 lines)
  • Modern architecture (async/await, type hints)
  • Clean structure (modular, testable)
  • Same features (FLUX, Hunyuan3D, Blender, caching)
  • Better maintainability

Enjoy your streamlined 3D asset generator! ๐ŸŽฎ