π Hugging Face Spaces Deployment - Step by Step
Your Current Space
- URL: https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/AndesOps-AI
- Status: β Active
- Likes: 21 π
β‘ Deployment Strategy for Maximum Likes
We're using TWO SPACES architecture:
- Frontend Space: Your existing AndesOps-AI space
- Backend Space: New andesai-backend space
This is the professional setup that gets more π likes!
π¦ Step 1: Update Your GitHub Repository
Push all changes to your GitHub repo:
cd c:\laragon\www\ANDESAI
# Ensure everything is committed
git add -A
git commit -m "π Optimized for Hugging Face Spaces - Production ready"
git push origin main
Changes pushed:
- β Optimized Dockerfiles (multi-stage builds)
- β .dockerignore files
- β Updated README.md (both frontend & backend)
- β Improved API auto-detection for HF Spaces
- β Health checks configured
π― Step 2: Create Backend Space on Hugging Face
2a. Create New Space
- Go to: https://huggingface.co/spaces
- Click "Create new space"
- Fill in:
Name: andesai-backend License: OpenRAIL SDK: Docker Space Hardware: CPU basic (or GPU if you want faster) Private: No (public helps with likes!) - Click Create Space
2b. Configure Backend Space
The space will open empty. Now connect your GitHub repo:
Option A: Manual Upload (Quick)
- Go to your new space settings: https://huggingface.co/spaces/your-username/andesai-backend/settings
- Click "Repo" tab
- Click "Import code from GitHub"
- Select your repo:
your-username/ANDESAI - Branch:
main - Space directory:
backend/(important!)
Option B: Use Git Clone (Automatic)
# In terminal
cd ~/hugging-face-spaces
git clone https://huggingface.co/spaces/your-username/andesai-backend
cd andesai-backend
# Copy backend files
cp -r ~/path/to/ANDESAI/backend/* .
# Commit and push
git add -A
git commit -m "Add backend files"
git push
# Space auto-rebuilds!
2c: Add Environment Secrets
In your andesai-backend space:
- Go to Settings β Secrets
- Add these (copy from your local
backend/.env):
MERCADO_PUBLICO_TICKET=YOUR_TICKET_HERE
GEMINI_API_KEY=YOUR_GEMINI_KEY_HERE
GROQ_API_KEY=YOUR_GROQ_KEY_HERE
FEATHERLESS_API_KEY=YOUR_FEATHERLESS_KEY_HERE
DATABASE_URL=sqlite:///./andesops.db
GEMINI_MODEL=gemini-2.0-flash
- Click Save for each
β Backend space will now be accessible at:
https://your-username-andesai-backend.hf.space
π¨ Step 3: Update Your Frontend Space (AndesOps-AI)
Your current space already exists! We just need to update it.
3a: Update the Frontend
- Go to: https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/AndesOps-AI
- Click Settings (gear icon)
- Under "Repo", you can:
- Update from GitHub if it's connected
- Or manually upload new files
3b: Upload Frontend Files
If not connected to GitHub, manually upload:
- Click "Files" tab in your space
- Upload these from
frontend/:.dockerignore Dockerfile (new optimized version) README.md (updated) package.json package-lock.json next.config.js postcss.config.js tailwind.config.ts tsconfig.json app/ components/ lib/ public/ globals.css
3c: Verify Frontend Configuration
The frontend now has automatic backend detection for HF Spaces:
// lib/api.ts automatically detects:
// - Frontend: lablab-ai-amd-developer-hackathon-andesops-ai.hf.space
// - Backend: lablab-ai-amd-developer-hackathon-andesops-ai-backend.hf.space
β No manual configuration needed!
π Step 4: Test the Connection
Wait for both spaces to finish building (5-10 minutes):
Check Backend Space:
- Open: https://your-username-andesai-backend.hf.space/api/health
- Should show:
{"status":"ok"}or similar
Check Frontend Space:
- Open: https://your-username-andesops-ai.hf.space
- Should load the UI
Test Features:
- Open Market Monitor β Should load purchase orders
- Open Tender Search β Try searching
- Check browser console (F12) for API logs
π οΈ Step 5: Optimize for Maximum Likes
A. Perfect README Description
In your AndesOps-AI space, go to Info and set:
# AndesOps AI - Real-time Chilean Public Procurement Intelligence
π **Hackathon Entry**: lablab AI + AMD Developer Hackathon 2026
## Features
- π Real-time market data from Mercado PΓΊblico
- π€ AI-powered tender analysis
- π± Compra Γgil (Agile Purchase) scraping
- π Purchase order monitoring
- πΌ Company profile management
## How It Works
1. Search for procurement opportunities
2. AI analyzes tender fit for your company
3. Get insights and recommendations
4. Draft proposals
## Tech Stack
- Frontend: Next.js 14 + React 18 + Tailwind CSS
- Backend: FastAPI + SQLAlchemy + PostgreSQL
- AI: Google Gemini + Groq + Featherless
## Components
- **Frontend**: Glass-morphism UI with real-time updates
- **Backend**: REST API with async operations
- **Database**: Persistent tender & analysis history
β **Like this space if it helps you!** Every like helps us win the hackathon!
B. Add Screenshots/Demo
Create a visual demo showing:
- Market Monitor with live data
- Tender Search interface
- AI Analysis panel
- Admin dashboard
C. Share on Social Media
π Just deployed AndesOps AI on @huggingface Spaces!
π¨π± Real-time Chilean public procurement intelligence
π€ AI-powered tender analysis
β Give it a like to support our hackathon entry!
[Link to space]
#HuggingFace #AI #Hackathon #Chile
β Deployment Checklist
- GitHub repo updated with all changes
- Backend space created (
andesai-backend) - Backend environment secrets added
- Frontend space updated
- Both spaces built successfully (green status)
-
/api/healthendpoint responding - Frontend loads without errors
- Market Monitor shows data
- Tender Search works
- README optimized for likes
- Shared on social media
π§ͺ Testing Commands
From your terminal, test each endpoint:
# Replace {username} and {space-name} with actual values
# Backend health
curl https://{username}-andesai-backend.hf.space/api/health
# Get tenders
curl "https://{username}-andesai-backend.hf.space/api/tenders?skip=0&limit=10"
# Get purchase orders
curl "https://{username}-andesai-backend.hf.space/api/purchase-orders"
# Frontend should auto-detect and connect
# Just open: https://{username}-andesops-ai.hf.space
π Troubleshooting
Frontend shows "Connection Error"
Check:
- Backend space is running (green status)
/api/healthendpoint is responding- Browser console (F12) for error messages
Fix:
# Rebuild backend space:
# Go to space β Settings β Restart Space
Backend won't start
Check:
- All environment secrets are set
.envfile is NOT uploaded (security risk)- Secrets are in Settings β Secrets, not Variables
Fix:
- Verify each secret in Settings
- Restart the space
- Check space logs for errors
"502 Bad Gateway"
Usually means:
- Backend is still building
- Wait 5-10 minutes
- If persists, check space logs
To view logs:
- Go to space
- Click "Runtime" β "View logs"
π Resources
- Hugging Face Spaces Docs: https://huggingface.co/docs/hub/spaces
- Docker in Spaces: https://huggingface.co/docs/hub/spaces-config-reference
- Your Frontend Space: https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/AndesOps-AI
π― Success Metrics
After deployment, you should see:
β
Both spaces "Running" (green status)
β
Frontend loads without 404 errors
β
Market Monitor displays real data
β
Tender Search returns results
β
Console shows [API] logs with correct URLs
β
API endpoints responding (no 502 errors)
π Next Steps to Win
Get More Likes:
- Share your space URL widely
- Post on Twitter/LinkedIn
- Show classmates and colleagues
- Post in hackathon Slack channel
Improve Features:
- Add more filters to Tender Search
- Show more statistics in Market Monitor
- Add export functionality
- Implement user authentication
Optimize Performance:
- Add caching for API responses
- Optimize database queries
- Reduce Docker image size
- Add pagination
π‘ Pro Tips
- Update your space regularly β More activity = More visibility = More likes!
- Share your progress β "Just added feature X to AndesOps AI!"
- Help others β Answer questions in space comments
- Engage community β Like and comment on other hackathon projects
π Quick Reference
| What | Where | Status |
|---|---|---|
| Frontend Space | https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/AndesOps-AI | β |
| Backend Space | https://huggingface.co/spaces/{you}/andesai-backend | π Create |
| GitHub Repo | https://github.com/yourusername/ANDESAI | β |
| Current Likes | 21 | π Going up! |
You're ready to deploy! π
Your AndesOps AI is production-ready and optimized for Hugging Face Spaces. Every component is configured for maximum performance and reliability.
Let me know when you've deployed and I'll help you optimize further for more likes! π