MyDuck / DEPLOY_GUIDE.md
suzmen's picture
Upload 6 files
a5d3815 verified

MyDuck AI - Hugging Face Spaces Deployment Guide

πŸš€ Quick Deploy to Hugging Face

Step 1: Create Hugging Face Account

  1. Go to https://huggingface.co/join
  2. Sign up for free account

Step 2: Create New Space

  1. Go to https://huggingface.co/new-space
  2. Fill in details:
    • Space name: myduck-ai (or your choice)
    • License: MIT
    • Select the Space SDK: Docker
    • Space hardware: CPU basic (Free)
  3. Click Create Space

Step 3: Upload Files

Upload these 4 files to your Space:

  1. Dockerfile
  2. README.md
  3. app.py
  4. requirements.txt

Method 1: Web Interface

  • Click "Files" tab β†’ "Add file" β†’ Upload each file

Method 2: Git (Recommended)

# Clone your space
git clone https://huggingface.co/spaces/YOUR_USERNAME/myduck-ai
cd myduck-ai

# Copy files
copy C:\Users\admin\Downloads\duckai\MyDuck-HuggingFace\* .

# Push to Hugging Face
git add .
git commit -m "Initial deployment"
git push

Step 4: Wait for Build

  • Hugging Face will automatically build your Docker container
  • Takes 2-5 minutes
  • Watch the "Building" status in the Space

Step 5: Test Your API

Once built, your API will be at:

https://YOUR_USERNAME-myduck-ai.hf.space/api/chat

Test with PowerShell:

(Invoke-WebRequest -Method Post -Uri "https://YOUR_USERNAME-myduck-ai.hf.space/api/chat" -Headers @{ "Content-Type" = "application/json" } -Body '{"prompt":"do you know english"}').Content

πŸ“ API Usage

Endpoint: POST /api/chat

Request:

{
  "prompt": "Your message here",
  "model": "gpt-4o-mini"
}

Response:

{
  "status": "success",
  "text": "AI response text"
}

🎯 Supported Models

  • gpt-4o-mini (default) - Fast and efficient
  • claude-3-haiku - Anthropic's Claude
  • llama - Llama 3.3 70B
  • mistral - Mixtral 8x7B
  • o3-mini - OpenAI O3

πŸ”§ Configuration

Default settings work out of the box. No API keys needed!

The app runs on port 7860 (Hugging Face default).

βœ… Advantages over Vercel

  • βœ… Works with DuckDuckGo (Vercel IPs are blocked)
  • βœ… Free forever (CPU basic tier)
  • βœ… No rate limits from Hugging Face
  • βœ… Easy deployment
  • βœ… Always online

πŸ“š Files in This Directory

MyDuck-HuggingFace/
β”œβ”€β”€ Dockerfile          # Docker container configuration
β”œβ”€β”€ README.md           # Hugging Face Space description
β”œβ”€β”€ app.py             # Flask API application
β”œβ”€β”€ requirements.txt    # Python dependencies
└── DEPLOY_GUIDE.md    # This file

πŸŽ“ Troubleshooting

Space shows error: Check the "Logs" tab in your Space

Build fails: Make sure all 4 files are uploaded correctly

Empty responses: The DuckDuckGo API may be temporarily unavailable, try again

429 errors: Too many requests, wait a few seconds and retry

🌟 Success!

Once deployed, share your API:

https://YOUR_USERNAME-myduck-ai.hf.space/api/chat

Enjoy free DuckDuckGo AI! πŸ¦†βœ¨