LapStore
commited on
Commit
·
3fca0b4
1
Parent(s):
4b22123
modified back mGE STEP 1
Browse files
app.py
CHANGED
|
@@ -50,10 +50,10 @@ async def image_step1(image_file: UploadFile = File(...),background_image: Optio
|
|
| 50 |
# Return the processed image for download
|
| 51 |
# return FileResponse(output_file_path_tmp, media_type='image/png', filename="/tmp/tmp_processed_image.png")
|
| 52 |
|
| 53 |
-
|
| 54 |
# Convert the image to base64 to return it in the response
|
| 55 |
buffered = io.BytesIO()
|
| 56 |
-
|
| 57 |
encoded_img = base64.b64encode(buffered.getvalue()).decode("utf-8")
|
| 58 |
|
| 59 |
# Returning both text and the base64 image
|
|
@@ -62,8 +62,8 @@ async def image_step1(image_file: UploadFile = File(...),background_image: Optio
|
|
| 62 |
"message": "Image processed successfully",
|
| 63 |
"image_base64": encoded_img
|
| 64 |
}
|
|
|
|
| 65 |
'''
|
| 66 |
-
|
| 67 |
buffer = io.BytesIO()
|
| 68 |
produced_image.save(buffer, format="PNG")
|
| 69 |
buffer.seek(0)
|
|
@@ -71,7 +71,7 @@ async def image_step1(image_file: UploadFile = File(...),background_image: Optio
|
|
| 71 |
buffer, media_type="image/png",
|
| 72 |
headers={"Content-Disposition": "attachment; filename=processed_image.png"}
|
| 73 |
)
|
| 74 |
-
|
| 75 |
@app.post('/imageStep2')
|
| 76 |
async def image_step2(image_file: UploadFile = File(...),things_replace: str = Form(...), blur_radius: str = Form(...)):#--->,background_image: UploadFile = File(...)):
|
| 77 |
|
|
|
|
| 50 |
# Return the processed image for download
|
| 51 |
# return FileResponse(output_file_path_tmp, media_type='image/png', filename="/tmp/tmp_processed_image.png")
|
| 52 |
|
| 53 |
+
|
| 54 |
# Convert the image to base64 to return it in the response
|
| 55 |
buffered = io.BytesIO()
|
| 56 |
+
produced_image.save(buffered, format="PNG")
|
| 57 |
encoded_img = base64.b64encode(buffered.getvalue()).decode("utf-8")
|
| 58 |
|
| 59 |
# Returning both text and the base64 image
|
|
|
|
| 62 |
"message": "Image processed successfully",
|
| 63 |
"image_base64": encoded_img
|
| 64 |
}
|
| 65 |
+
|
| 66 |
'''
|
|
|
|
| 67 |
buffer = io.BytesIO()
|
| 68 |
produced_image.save(buffer, format="PNG")
|
| 69 |
buffer.seek(0)
|
|
|
|
| 71 |
buffer, media_type="image/png",
|
| 72 |
headers={"Content-Disposition": "attachment; filename=processed_image.png"}
|
| 73 |
)
|
| 74 |
+
'''
|
| 75 |
@app.post('/imageStep2')
|
| 76 |
async def image_step2(image_file: UploadFile = File(...),things_replace: str = Form(...), blur_radius: str = Form(...)):#--->,background_image: UploadFile = File(...)):
|
| 77 |
|