LogicGoInfotechSpaces commited on
Commit
a3555e5
·
verified ·
1 Parent(s): e371999

Delete HTTP_API_Documentation.txt

Browse files
Files changed (1) hide show
  1. HTTP_API_Documentation.txt +0 -186
HTTP_API_Documentation.txt DELETED
@@ -1,186 +0,0 @@
1
- HTTP API Documentation - Photo Object Removal Service
2
-
3
- Base URL: https://logicgoinfotechspaces-object-remover.hf.space
4
-
5
- Authentication:
6
- - Optional Bearer token authentication
7
- - Set API_TOKEN environment variable on server to enable auth
8
- - Send header: Authorization: Bearer <API_TOKEN>
9
- - If API_TOKEN not set, all endpoints are publicly accessible
10
- - Inpainting work is delegated to Google Gemini/Imagen edit API; no GPU is needed on the server.
11
- - Uploads are stored in MongoDB GridFS (database `object_remover`); the IDs returned by upload endpoints are fetched from GridFS when processing.
12
-
13
- Available Endpoints:
14
-
15
- 1. GET /health
16
- - Health check endpoint
17
- - Returns: {"status":"healthy"}
18
- - No authentication required
19
-
20
- 2. POST /upload-image
21
- - Upload an image file for processing
22
- - Content-Type: multipart/form-data
23
- - Form field: image (file)
24
- - Returns: {"id":"<image_id>","filename":"original_name.png"}
25
- - Supported formats: PNG, JPG, JPEG
26
-
27
- 3. POST /upload-mask
28
- - Upload a mask file indicating areas to remove
29
- - Content-Type: multipart/form-data
30
- - Form field: mask (file)
31
- - Returns: {"id":"<mask_id>","filename":"mask.png"}
32
- - Mask formats:
33
- * RGBA PNG: pixels with alpha=0 are treated as areas to remove
34
- * RGB/Grayscale: pixels with value > 0 are treated as areas to remove
35
-
36
- 4. POST /inpaint
37
- - Process inpainting using uploaded image and mask IDs
38
- - Content-Type: application/json
39
- - Body: {"image_id":"<image_id>","mask_id":"<mask_id>","prompt":"optional text about what to remove"}
40
- - Returns: {"result":"output_xxx.png"}
41
- - Simple response with just the filename
42
-
43
- 5. POST /inpaint-url
44
- - Same as /inpaint but returns JSON with public download URL
45
- - Content-Type: application/json
46
- - Body: {"image_id":"<image_id>","mask_id":"<mask_id>","prompt":"optional text about what to remove"}
47
- - Returns: {"result":"output_xxx.png","url":"https://.../download/output_xxx.png"}
48
- - Use this endpoint if you need a shareable URL
49
-
50
- 6. POST /inpaint-multipart
51
- - Process inpainting with direct file upload (no separate upload steps)
52
- - Content-Type: multipart/form-data
53
- - Form fields: image (file), mask (file), prompt (optional text)
54
- - Returns: {"result":"output_xxx.png","url":"https://.../download/output_xxx.png"}
55
-
56
- 7. GET /download/{filename}
57
- - Download result image by filename
58
- - Public endpoint (no authentication required)
59
- - Returns: image/png (binary data)
60
- - Can be opened directly in browser
61
-
62
- 8. GET /result/{filename}
63
- - View result image directly in browser
64
- - Public endpoint (no authentication required)
65
- - Returns: image/png with proper content-type for viewing
66
- - Optimized for browser display
67
-
68
- CURL EXAMPLES:
69
-
70
- 1. Health Check:
71
- curl -H "Authorization: Bearer <API_TOKEN>" \
72
- https://logicgoinfotechspaces-object-remover.hf.space/health
73
-
74
- 2. Upload Image:
75
- curl -H "Authorization: Bearer <API_TOKEN>" \
76
- -F image=@image.png \
77
- https://logicgoinfotechspaces-object-remover.hf.space/upload-image
78
- # Response: {"id":"9cf61445-f83b-4c97-9272-c81647f90d68","filename":"image.png"}
79
-
80
- 3. Upload Mask:
81
- curl -H "Authorization: Bearer <API_TOKEN>" \
82
- -F mask=@mask.png \
83
- https://logicgoinfotechspaces-object-remover.hf.space/upload-mask
84
- # Response: {"id":"d044a390-dde2-408a-b7cf-d508385e56ed","filename":"mask.png"}
85
-
86
- 4. Inpaint (returns simple JSON):
87
- curl -H "Authorization: Bearer <API_TOKEN>" \
88
- -H "Content-Type: application/json" \
89
- -d '{"image_id":"9cf61445-f83b-4c97-9272-c81647f90d68","mask_id":"d044a390-dde2-408a-b7cf-d508385e56ed","prompt":"Remove the car and repair the road"}' \
90
- https://logicgoinfotechspaces-object-remover.hf.space/inpaint
91
- # Response: {"result":"output_b09568698bbd4aa591b1598c01f2f745.png"}
92
-
93
- 5. Inpaint-URL (returns JSON with public URL):
94
- curl -H "Authorization: Bearer <API_TOKEN>" \
95
- -H "Content-Type: application/json" \
96
- -d '{"image_id":"9cf61445-f83b-4c97-9272-c81647f90d68","mask_id":"d044a390-dde2-408a-b7cf-d508385e56ed","prompt":"Remove the car and repair the road"}' \
97
- https://logicgoinfotechspaces-object-remover.hf.space/inpaint-url
98
- # Response: {"result":"output_b09568698bbd4aa591b1598c01f2f745.png","url":"https://logicgoinfotechspaces-object-remover.hf.space/download/output_b09568698bbd4aa591b1598c01f2f745.png"}
99
-
100
- 6. Inpaint Multipart (one-step processing):
101
- curl -H "Authorization: Bearer <API_TOKEN>" \
102
- -F image=@image.png \
103
- -F mask=@mask.png \
104
- https://logicgoinfotechspaces-object-remover.hf.space/inpaint-multipart
105
- # Response: {"result":"output_xxx.png","url":"https://logicgoinfotechspaces-object-remover.hf.space/download/output_xxx.png"}
106
-
107
- 7. Download Result (public, no auth):
108
- curl -L https://logicgoinfotechspaces-object-remover.hf.space/download/output_b09568698bbd4aa591b1598c01f2f745.png \
109
- -o result.png
110
-
111
- 8. View Result in Browser (public, no auth):
112
- curl -L https://logicgoinfotechspaces-object-remover.hf.space/result/output_b09568698bbd4aa591b1598c01f2f745.png \
113
- -o result.png
114
-
115
- POSTMAN EXAMPLES:
116
-
117
- 1. Health Check:
118
- Method: GET
119
- URL: https://logicgoinfotechspaces-object-remover.hf.space/health
120
- Headers: Authorization: Bearer <API_TOKEN>
121
-
122
- 2. Upload Image:
123
- Method: POST
124
- URL: https://logicgoinfotechspaces-object-remover.hf.space/upload-image
125
- Headers: Authorization: Bearer <API_TOKEN>
126
- Body: form-data
127
- Key: image, Type: File, Value: select your image file
128
-
129
- 3. Upload Mask:
130
- Method: POST
131
- URL: https://logicgoinfotechspaces-object-remover.hf.space/upload-mask
132
- Headers: Authorization: Bearer <API_TOKEN>
133
- Body: form-data
134
- Key: mask, Type: File, Value: select your mask file
135
-
136
- 4. Inpaint (returns simple JSON):
137
- Method: POST
138
- URL: https://logicgoinfotechspaces-object-remover.hf.space/inpaint
139
- Headers:
140
- - Authorization: Bearer <API_TOKEN>
141
- - Content-Type: application/json
142
- Body: raw JSON
143
- {
144
- "image_id": "9cf61445-f83b-4c97-9272-c81647f90d68",
145
- "mask_id": "d044a390-dde2-408a-b7cf-d508385e56ed",
146
- "prompt": "Remove the car and restore the street"
147
- }
148
-
149
- 5. Inpaint Multipart (one-step):
150
- Method: POST
151
- URL: https://logicgoinfotechspaces-object-remover.hf.space/inpaint-multipart
152
- Headers: Authorization: Bearer <API_TOKEN>
153
- Body: form-data
154
- Key: image, Type: File, Value: select your image file
155
- Key: mask, Type: File, Value: select your mask file
156
- Key: prompt, Type: Text, Value: describe what to remove (optional)
157
-
158
- IMPORTANT NOTES:
159
-
160
- Authentication:
161
- - If API_TOKEN is set on the server, include Authorization header
162
- - If API_TOKEN is not set, omit Authorization header
163
- - /download/{filename} is always public (no auth required)
164
-
165
- Mask Formats:
166
- - RGBA PNG: pixels with alpha=0 are treated as areas to remove
167
- - RGB/Grayscale: pixels with value > 0 are treated as areas to remove
168
- - Create mask by painting white/colored areas over objects you want to remove
169
-
170
- Error Handling:
171
- - 404 Not Found on /inpaint: server restarted, IDs expired - re-upload files
172
- - 401 Unauthorized: missing or invalid API_TOKEN
173
- - 403 Forbidden: wrong API_TOKEN
174
-
175
- Workflow Options:
176
- 1. Two-step: upload-image → upload-mask → inpaint (get filename)
177
- 2. One-step: inpaint-multipart (upload and process in single request)
178
- 3. Direct access: use /download/{filename} or /result/{filename} with returned filename
179
-
180
- Browser Access:
181
- - Paste any /download/{filename} or /result/{filename} URL directly in Chrome to view the result
182
- - No authentication required for download/view URLs
183
- - /result/{filename} is optimized for browser viewing
184
- - Examples:
185
- * https://logicgoinfotechspaces-object-remover.hf.space/download/output_b09568698bbd4aa591b1598c01f2f745.png
186
- * https://logicgoinfotechspaces-object-remover.hf.space/result/output_b09568698bbd4aa591b1598c01f2f745.png