kalhdrawi commited on
Commit
3bf1031
·
1 Parent(s): fc3c272

إضافة ملفات جديدة

Browse files
Files changed (1) hide show
  1. README.md +53 -0
README.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: BRIA RMBG 1.4
3
+ emoji: 💻
4
+ colorFrom: red
5
+ colorTo: red
6
+ sdk: docker
7
+ pinned: false
8
+ license: other
9
+ ---
10
+
11
+ BRIA RMBG 1.4 - Dockerized Web App and API
12
+
13
+ This is a Docker-based FastAPI service with a simple HTML frontend and a programmatic API for background removal.
14
+
15
+ Features
16
+ - FastAPI backend serving:
17
+ - POST /api/remove_bg (returns PNG bytes or JSON base64)
18
+ - POST /api/matte (alpha matte)
19
+ - GET /health
20
+ - Static HTML/CSS/JS UI under /static
21
+ - Dockerfile for containerized deployment
22
+
23
+ Local development
24
+ - Install deps (recommended inside a venv):
25
+ pip install -r requirements.txt fastapi uvicorn[standard]
26
+ - Run
27
+ uvicorn server:app --host 0.0.0.0 --port 7860
28
+ - Open http://localhost:7860
29
+
30
+ Docker
31
+ - Build
32
+ docker build -t bria-rmbg:latest .
33
+ - Run
34
+ docker run --rm -p 7860:7860 bria-rmbg:latest
35
+
36
+ API examples
37
+ - cURL (PNG bytes)
38
+ curl -X POST "http://localhost:7860/api/remove_bg?output=image" -F "file=@./input.jpg" --output result.png
39
+ - cURL (JSON base64)
40
+ curl -X POST "http://localhost:7860/api/remove_bg?output=json" -F "file=@./input.jpg" | jq -r .image_base64 | base64 --decode > result.png
41
+ - Python
42
+ import requests
43
+ with open("./input.jpg", "rb") as f:
44
+ r = requests.post(
45
+ "http://localhost:7860/api/remove_bg?output=image",
46
+ files={"file": ("image.jpg", f, "image/jpeg")},
47
+ )
48
+ open("result.png", "wb").write(r.content)
49
+
50
+ Notes
51
+ - On first run the model weights (briaai/RMBG-1.4) are downloaded from Hugging Face Hub.
52
+ - For GPU support, use a CUDA-enabled base image and ensure PyTorch CUDA is installed.
53
+