MyDuck AI - Hugging Face Spaces Deployment Guide
π Quick Deploy to Hugging Face
Step 1: Create Hugging Face Account
- Go to https://huggingface.co/join
- Sign up for free account
Step 2: Create New Space
- Go to https://huggingface.co/new-space
- Fill in details:
- Space name:
myduck-ai(or your choice) - License: MIT
- Select the Space SDK: Docker
- Space hardware: CPU basic (Free)
- Space name:
- Click Create Space
Step 3: Upload Files
Upload these 4 files to your Space:
DockerfileREADME.mdapp.pyrequirements.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 efficientclaude-3-haiku- Anthropic's Claudellama- Llama 3.3 70Bmistral- Mixtral 8x7Bo3-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! π¦β¨