| # π 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: |
|
|
| ```bash |
| 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 |
|
|
| 1. Go to: https://huggingface.co/spaces |
| 2. Click **"Create new space"** |
| 3. 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!) |
| ``` |
| 4. Click **Create Space** |
|
|
| ### 2b. Configure Backend Space |
|
|
| The space will open empty. Now connect your GitHub repo: |
|
|
| **Option A: Manual Upload (Quick)** |
| 1. Go to your new space settings: https://huggingface.co/spaces/your-username/andesai-backend/settings |
| 2. Click **"Repo" tab** |
| 3. Click **"Import code from GitHub"** |
| 4. Select your repo: `your-username/ANDESAI` |
| 5. Branch: `main` |
| 6. Space directory: `backend/` (important!) |
|
|
| **Option B: Use Git Clone (Automatic)** |
| ```bash |
| # 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: |
|
|
| 1. Go to **Settings β Secrets** |
| 2. 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 |
| ``` |
|
|
| 3. 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 |
|
|
| 1. Go to: https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/AndesOps-AI |
| 2. Click **Settings** (gear icon) |
| 3. 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: |
|
|
| 1. Click **"Files"** tab in your space |
| 2. 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: |
|
|
| ```typescript |
| // 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): |
|
|
| 1. **Check Backend Space**: |
| - Open: https://your-username-andesai-backend.hf.space/api/health |
| - Should show: `{"status":"ok"}` or similar |
|
|
| 2. **Check Frontend Space**: |
| - Open: https://your-username-andesops-ai.hf.space |
| - Should load the UI |
|
|
| 3. **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: |
|
|
| ```markdown |
| # 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: |
| 1. Market Monitor with live data |
| 2. Tender Search interface |
| 3. AI Analysis panel |
| 4. 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/health` endpoint 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: |
|
|
| ```bash |
| # 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:** |
| 1. Backend space is running (green status) |
| 2. `/api/health` endpoint is responding |
| 3. Browser console (F12) for error messages |
|
|
| **Fix:** |
| ```bash |
| # Rebuild backend space: |
| # Go to space β Settings β Restart Space |
| ``` |
|
|
| ### Backend won't start |
|
|
| **Check:** |
| 1. All environment secrets are set |
| 2. `.env` file is NOT uploaded (security risk) |
| 3. Secrets are in **Settings β Secrets**, not Variables |
|
|
| **Fix:** |
| 1. Verify each secret in Settings |
| 2. Restart the space |
| 3. 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:** |
| 1. Go to space |
| 2. 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 |
|
|
| 1. **Get More Likes**: |
| - Share your space URL widely |
| - Post on Twitter/LinkedIn |
| - Show classmates and colleagues |
| - Post in hackathon Slack channel |
|
|
| 2. **Improve Features**: |
| - Add more filters to Tender Search |
| - Show more statistics in Market Monitor |
| - Add export functionality |
| - Implement user authentication |
|
|
| 3. **Optimize Performance**: |
| - Add caching for API responses |
| - Optimize database queries |
| - Reduce Docker image size |
| - Add pagination |
|
|
| --- |
|
|
| ## π‘ Pro Tips |
|
|
| 1. **Update your space regularly** β More activity = More visibility = More likes! |
| 2. **Share your progress** β "Just added feature X to AndesOps AI!" |
| 3. **Help others** β Answer questions in space comments |
| 4. **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! π |
|
|