Truncated base64 mask display on UI
Browse files- app/main.py +5 -2
app/main.py
CHANGED
|
@@ -75,6 +75,9 @@ TEMPLATES = Jinja2Templates(directory='templates')
|
|
| 75 |
# Max file size for uploads (5 MB)
|
| 76 |
MAX_FILE_SIZE = 5 * 1024 * 1024 # 5 MB
|
| 77 |
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
# MAIN APPLICATION
|
| 80 |
|
|
@@ -223,7 +226,7 @@ async def upload(
|
|
| 223 |
result = {
|
| 224 |
'class_id': class_id,
|
| 225 |
'class_name': class_name,
|
| 226 |
-
'mask64_PNG_L': mask64,
|
| 227 |
}
|
| 228 |
|
| 229 |
# Schedule deletion of both images after 10 seconds
|
|
@@ -279,7 +282,7 @@ async def random_sample(request: Request, background_tasks: BackgroundTasks = No
|
|
| 279 |
result = {
|
| 280 |
'class_id': class_id,
|
| 281 |
'class_name': class_name,
|
| 282 |
-
'mask64_PNG_L': mask64,
|
| 283 |
}
|
| 284 |
|
| 285 |
# Schedule deletion of both images after 10 seconds
|
|
|
|
| 75 |
# Max file size for uploads (5 MB)
|
| 76 |
MAX_FILE_SIZE = 5 * 1024 * 1024 # 5 MB
|
| 77 |
|
| 78 |
+
# Max characters from the BASE64 mask to include in the HTML display
|
| 79 |
+
MAX_BASE64_DISPLAY = 10
|
| 80 |
+
|
| 81 |
|
| 82 |
# MAIN APPLICATION
|
| 83 |
|
|
|
|
| 226 |
result = {
|
| 227 |
'class_id': class_id,
|
| 228 |
'class_name': class_name,
|
| 229 |
+
'mask64_PNG_L': mask64[:MAX_BASE64_DISPLAY] + "...", # Truncated for HTML display
|
| 230 |
}
|
| 231 |
|
| 232 |
# Schedule deletion of both images after 10 seconds
|
|
|
|
| 282 |
result = {
|
| 283 |
'class_id': class_id,
|
| 284 |
'class_name': class_name,
|
| 285 |
+
'mask64_PNG_L': mask64[:MAX_BASE64_DISPLAY] + "...", # Truncated for HTML display
|
| 286 |
}
|
| 287 |
|
| 288 |
# Schedule deletion of both images after 10 seconds
|