File size: 4,657 Bytes
7c012de |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# π Deploying KnowledgeBridge to Hugging Face Spaces
## π€ Track 3: Agentic Demo Showcase
This guide will help you deploy KnowledgeBridge to Hugging Face Spaces for the **Agents-MCP-Hackathon Track 3: Agentic Demo Showcase** - demonstrating the incredible power of AI agents working together!
## π― Prerequisites
1. **Hugging Face Account**: Sign up at [huggingface.co](https://huggingface.co)
2. **API Keys**: Get your Nebius AI API key from [studio.nebius.ai](https://studio.nebius.ai)
3. **Git**: Ensure git is installed on your system
## π¦ Step-by-Step Deployment
### 1. Create a New Hugging Face Space
1. Go to [Hugging Face Spaces](https://huggingface.co/spaces)
2. Click **"Create new Space"**
3. Fill in the details:
- **Space name**: `KnowledgeBridge`
- **License**: `MIT`
- **Space SDK**: `Docker`
- **Visibility**: `Public`
4. Click **"Create Space"**
### 2. Clone Your New Space Repository
```bash
# Clone the empty space repository
git clone https://huggingface.co/spaces/YOUR_USERNAME/KnowledgeBridge
cd KnowledgeBridge
```
### 3. Copy KnowledgeBridge Files
```bash
# Copy all files from your local KnowledgeBridge project
cp -r /path/to/your/KnowledgeBridge/* .
cp -r /path/to/your/KnowledgeBridge/.* . 2>/dev/null || true
# Make sure you have these key files:
ls -la
# Should see: Dockerfile, package.json, .env.example, README.md, etc.
```
### 4. Configure Environment Variables
1. Go to your Space settings on Hugging Face
2. Navigate to **"Variables and secrets"**
3. Add these environment variables:
```bash
# Required
NEBIUS_API_KEY=your_actual_nebius_api_key_here
NODE_ENV=production
PORT=7860
# Optional but recommended
GITHUB_TOKEN=your_github_token_here
MODAL_TOKEN_ID=your_modal_token_id
MODAL_TOKEN_SECRET=your_modal_token_secret
```
### 5. Update README.md
Replace `YOUR_USERNAME` in the README.md with your actual Hugging Face username:
```markdown
**Live Demo**: [Try KnowledgeBridge on Hugging Face Spaces](https://huggingface.co/spaces/YOUR_USERNAME/KnowledgeBridge)
```
### 6. Commit and Push
```bash
# Add all files
git add .
# Commit with a descriptive message
git commit -m "π Deploy KnowledgeBridge to Hugging Face Spaces
- AI-enhanced knowledge discovery platform
- Multi-source search (GitHub, Wikipedia, ArXiv)
- Interactive knowledge graphs and visualizations
- Enterprise-grade security and performance
- Built for Agents-MCP-Hackathon"
# Push to deploy
git push origin main
```
### 7. Monitor Deployment
1. Go to your Space page: `https://huggingface.co/spaces/YOUR_USERNAME/KnowledgeBridge`
2. You'll see the build logs in real-time
3. The deployment typically takes 3-5 minutes
4. Once complete, your app will be available at the Space URL
## β
Verification Steps
After deployment, verify these features work:
1. **Health Check**: Visit `/api/health` - should show all services healthy
2. **Search**: Try searching for "machine learning"
3. **AI Assistant**: Click the π€ button and test explanations
4. **Knowledge Graph**: Navigate to the Knowledge Graph tab
5. **Document Analysis**: Test with sample content
## π§ Troubleshooting
### Common Issues:
1. **Build Fails**:
- Check the build logs in your Space
- Ensure all dependencies are in `package.json`
- Verify Dockerfile syntax
2. **App Doesn't Start**:
- Check environment variables are set correctly
- Ensure PORT=7860 is configured
- Verify the start script in package.json
3. **API Errors**:
- Ensure NEBIUS_API_KEY is valid and has credits
- Check the logs for specific error messages
- Verify network connectivity to external APIs
### Debug Commands:
If you need to debug, you can check logs:
```bash
# View recent logs (if you have CLI access)
docker logs <container_id>
```
## π Success!
Once deployed successfully, your KnowledgeBridge app will be live at:
`https://huggingface.co/spaces/YOUR_USERNAME/KnowledgeBridge`
Share this URL in your hackathon submission!
## π Hackathon Submission Checklist
- β
App deployed and accessible on Hugging Face Spaces
- β
All core features working (search, AI assistant, knowledge graph)
- β
Environment variables configured securely
- β
README updated with live demo link
- β
Submission includes Space URL
- β
All APIs responding correctly
## π Useful Links
- [Hugging Face Spaces Documentation](https://huggingface.co/docs/hub/spaces)
- [Docker for Spaces Guide](https://huggingface.co/docs/hub/spaces-sdks-docker)
- [Agents-MCP-Hackathon](https://huggingface.co/Agents-MCP-Hackathon)
- [Nebius AI Documentation](https://docs.nebius.ai/)
Good luck with your hackathon submission! π |