lost-found / README.md
Mishut-17's picture
Update README.md
2407107 verified
|
Raw
History Blame Contribute Delete
2.98 kB
---
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
1. **Install dependencies:**
```bash
cd backend
pip install -r requirements.txt
```
2. **Set up environment (optional):**
```bash
cp .env.example .env
# Edit .env with your configuration
```
3. **Run the backend:**
```bash
python main.py
```
The server will start at `http://localhost:7860`
## πŸ”Œ API Endpoints
### Main Routes
- `GET /` - Serves frontend index.html
- `GET /admin` - Serves admin dashboard
- `GET /guard` - Serves guard dashboard
### Lost & Found Routes
- `POST /report-found` - Report a found item
- Parameters: `file` (image), `location`, `contact`, `description`, `category`
- `POST /search-lost` - Search for matching items
- Parameters: `file` (image) OR `text_query`
- `GET /all-found` - Get all found items
## πŸ”§ Configuration
### Environment Variables
```
API_URL=http://localhost:7860
HUGGINGFACE_TOKEN=your_token_here
```
## πŸ“¦ Deployment
### Docker
```bash
cd backend
docker build -t 404-found-backend .
docker run -p 7860:7860 404-found-backend
```
### Hugging Face Spaces
1. Push code to repository
2. Create new Space on Hugging Face
3. Connect to this repository
4. Deploy automatically
### Traditional Server
```bash
# 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
```bash
# 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.