Face_Swap_Video / api /COLLECTIONS_INDEX.md
LogicGoInfotechSpaces's picture
Fix Dockerfile build errors: improve dependency installation order and error handling
02f88ee
# Face Swap Video API - Collections Index
**Base URL:** `https://logicgoinfotechspaces-face-swap-video.hf.space`
---
## πŸ“Š **MongoDB Collections**
### **1. source_images**
**Collection Name:** `source_images`
**Database:** `face_swap_video`
**Schema:**
```json
{
"_id": "ObjectId",
"filename": "string",
"file_path": "string",
"uploaded_at": "datetime",
"status": "string",
"content_type": "string",
"file_size": "number"
}
```
**API Endpoints:**
- **Upload:** `POST https://logicgoinfotechspaces-face-swap-video.hf.space/api/source-image`
- **List All:** `GET https://logicgoinfotechspaces-face-swap-video.hf.space/api/source-images`
- **Get One:** Use `_id` from list response
---
### **2. target_videos**
**Collection Name:** `target_videos`
**Database:** `face_swap_video`
**Schema:**
```json
{
"_id": "ObjectId",
"filename": "string",
"file_path": "string",
"uploaded_at": "datetime",
"status": "string",
"content_type": "string",
"file_size": "number"
}
```
**API Endpoints:**
- **Upload:** `POST https://logicgoinfotechspaces-face-swap-video.hf.space/api/target-video`
- **List All:** `GET https://logicgoinfotechspaces-face-swap-video.hf.space/api/target-videos`
- **Get One:** Use `_id` from list response
---
### **3. result_videos**
**Collection Name:** `result_videos`
**Database:** `face_swap_video`
**Schema:**
```json
{
"_id": "ObjectId",
"source_image_path": "string",
"target_video_path": "string",
"result_file_path": "string",
"created_at": "datetime",
"status": "string",
"job_id": "string",
"processing_time": "number (optional)"
}
```
**API Endpoints:**
- **Download:** `GET https://logicgoinfotechspaces-face-swap-video.hf.space/api/result-video/{result_video_id}`
- **List All:** `GET https://logicgoinfotechspaces-face-swap-video.hf.space/api/result-videos`
- **Get Download URL:** Use `result_video_url` from job status when `status = "completed"`
---
### **4. processing_jobs**
**Collection Name:** `processing_jobs`
**Database:** `face_swap_video`
**Schema:**
```json
{
"_id": "ObjectId",
"job_id": "string (UUID)",
"source_image_id": "string",
"target_video_id": "string",
"status": "string (queued|processing|completed|failed)",
"created_at": "datetime",
"progress": "number (0-100)",
"result_video_id": "string (optional)",
"result_video_url": "string (optional)",
"error": "string (optional)"
}
```
**API Endpoints:**
- **Create Job:** `POST https://logicgoinfotechspaces-face-swap-video.hf.space/api/face-swap`
- **Get Status:** `GET https://logicgoinfotechspaces-face-swap-video.hf.space/api/job/{job_id}`
---
## πŸ”— **Complete API Endpoints Index**
### **Upload Endpoints**
```
POST https://logicgoinfotechspaces-face-swap-video.hf.space/api/source-image
POST https://logicgoinfotechspaces-face-swap-video.hf.space/api/target-video
```
### **Processing Endpoints**
```
POST https://logicgoinfotechspaces-face-swap-video.hf.space/api/face-swap
GET https://logicgoinfotechspaces-face-swap-video.hf.space/api/job/{job_id}
```
### **Download Endpoints**
```
GET https://logicgoinfotechspaces-face-swap-video.hf.space/api/result-video/{result_video_id}
```
### **List Endpoints**
```
GET https://logicgoinfotechspaces-face-swap-video.hf.space/api/source-images
GET https://logicgoinfotechspaces-face-swap-video.hf.space/api/target-videos
GET https://logicgoinfotechspaces-face-swap-video.hf.space/api/result-videos
```
### **Utility Endpoints**
```
GET https://logicgoinfotechspaces-face-swap-video.hf.space/api/health
GET https://logicgoinfotechspaces-face-swap-video.hf.space/docs
GET https://logicgoinfotechspaces-face-swap-video.hf.space/
```
---
## πŸ“ **MongoDB Connection String**
```
mongodb+srv://itishalogicgo_db_user:HR837xi0B9yh2vZK@cluster0.jeeytpz.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0
```
**Database:** `face_swap_video`
**Collections:**
1. `source_images`
2. `target_videos`
3. `result_videos`
4. `processing_jobs`
---
## πŸ”„ **Workflow Example**
1. **Upload Source Image** β†’ Get `source_image_id`
2. **Upload Target Video** β†’ Get `target_video_id`
3. **Start Face Swap** β†’ Get `job_id`
4. **Poll Job Status** β†’ Get `result_video_url` when `status = "completed"`
5. **Download Result** β†’ Use `result_video_url` directly
---
## πŸ“‹ **Quick Reference**
| Collection | Insert Endpoint | List Endpoint | Get One |
|------------|----------------|---------------|---------|
| `source_images` | `POST /api/source-image` | `GET /api/source-images` | Use `_id` |
| `target_videos` | `POST /api/target-video` | `GET /api/target-videos` | Use `_id` |
| `result_videos` | Auto via job completion | `GET /api/result-videos` | `GET /api/result-video/{id}` |
| `processing_jobs` | `POST /api/face-swap` | N/A | `GET /api/job/{job_id}` |
---
## 🌐 **MongoDB Atlas Dashboard**
Access your collections at:
```
https://cloud.mongodb.com/
```
**Cluster:** `Cluster0`
**Database:** `face_swap_video`
**Collections:** 4 collections listed above