BuildTheFuture / DEPLOYMENT_GUIDE.md
Abs6187's picture
Upload 16 files
e98d661 verified

A newer version of the Gradio SDK is available: 6.2.0

Upgrade

πŸš€ Hugging Face Deployment Guide

Quick Deploy to Hugging Face Spaces

1. Create New Space

2. Upload Files

Upload these essential files:

  • app.py (main application)
  • requirements.txt (dependencies)
  • config.yaml (space configuration)
  • README.md (documentation)
  • packages.txt (system dependencies)
  • Dockerfile (optional)

3. Configure Secrets

In Space settings, add:

  • GEMINI_API_KEY: Your Google AI API key
  • ELEVENLABS_API_KEY: Your ElevenLabs API key (optional)

4. Space Configuration (config.yaml)

title: "🍌 Nano Banana: Dynamic Image Creation"
emoji: 🍌
colorFrom: yellow
colorTo: orange
sdk: gradio
sdk_version: "4.44.0"
app_file: app.py

5. API Keys Setup

Gemini API Key (Required)

  1. Visit Google AI Studio
  2. Create new API key
  3. Add to Space secrets as GEMINI_API_KEY

ElevenLabs API Key (Optional)

  1. Sign up at ElevenLabs
  2. Get API key from dashboard
  3. Add to Space secrets as ELEVENLABS_API_KEY

6. Deployment Process

  1. Upload files to Space
  2. Add API keys in Settings > Variables and secrets
  3. Space will automatically build and deploy
  4. Access your live demo at the Space URL

7. Edge Cases Handled

  • βœ… Missing API keys (graceful degradation)
  • βœ… Rate limiting (automatic retry with backoff)
  • βœ… Large images (automatic resizing)
  • βœ… Network timeouts (retry mechanism)
  • βœ… Invalid prompts (validation)
  • βœ… Optional features fallback

8. Performance Optimizations

  • Image compression and resizing
  • Rate limiting compliance (20 images/minute)
  • Efficient memory usage
  • Error recovery mechanisms

9. Competition Compliance

  • Gemini 2.5 Flash Image as primary model
  • Optional enhancements (YOLO, ElevenLabs)
  • Public accessibility without login
  • Video demo ready interface