Spaces:
Sleeping
Sleeping
metadata
title: 404 Found
emoji: π
colorFrom: blue
colorTo: indigo
sdk: docker
pinned: false
404 Found - Backend
AI-powered Lost & Found system backend using FastAPI and SigLIP2 vision-language model.
π Project Structure
backend/
βββ main.py # FastAPI application
βββ matcher_siglip.py # AI matching engine using SigLIP2
βββ storage_manager.py # Hugging Face storage integration
βββ requirements.txt # Python dependencies
βββ Dockerfile # Docker configuration
βββ dataset/ # Dataset files
βββ found_items/ # Storage for found item images
βββ lost_items/ # Storage for lost item images
βββ metadata.json # Item metadata
π Getting Started
Prerequisites
- Python 3.8+
- pip or conda
- CUDA (optional, for GPU acceleration)
Installation
- Install dependencies:
cd backend
pip install -r requirements.txt
- Set up environment (optional):
cp .env.example .env
# Edit .env with your configuration
- Run the backend:
python main.py
The server will start at http://localhost:7860
π API Endpoints
Main Routes
GET /- Serves frontend index.htmlGET /admin- Serves admin dashboardGET /guard- Serves guard dashboard
Lost & Found Routes
POST /report-found- Report a found item- Parameters:
file(image),location,contact,description,category
- Parameters:
POST /search-lost- Search for matching items- Parameters:
file(image) ORtext_query
- Parameters:
GET /all-found- Get all found items
π§ Configuration
Environment Variables
API_URL=http://localhost:7860
HUGGINGFACE_TOKEN=your_token_here
π¦ Deployment
Docker
cd backend
docker build -t 404-found-backend .
docker run -p 7860:7860 404-found-backend
Hugging Face Spaces
- Push code to repository
- Create new Space on Hugging Face
- Connect to this repository
- Deploy automatically
Traditional Server
# Using gunicorn
gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app --bind 0.0.0.0:7860
π€ AI Model
Uses SigLIP2 - a vision-language model from Google for:
- Image-to-image similarity matching
- Text-based search on images
- Confidence scoring (High/Medium/Low)
π Features
- β Image upload and storage
- β SigLIP2 AI matching (92% accuracy)
- β FAISS similarity search (<100ms)
- β Hugging Face Hub integration
- β Real-time item database
- β Multi-category support
π§ͺ Testing
# Run tests
python test_fastapi.py
python test_siglip.py
python test_multi.py
π License
See ../README.md for more information
π€ Support
For issues and questions, refer to the main project README.