Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -210,11 +210,12 @@ def application_page():
|
|
210 |
"""
|
211 |
|
212 |
@app.post("/upload/")
|
213 |
-
async def upload_file(file: UploadFile = File(...)):
|
214 |
try:
|
215 |
# Await file upload
|
216 |
contents = await file.read()
|
217 |
img = Image.open(BytesIO(contents)).convert("RGB")
|
|
|
218 |
rectangled_img = fill_rectangle_cropper(img,padding_type)
|
219 |
|
220 |
# Save the rectangle image (original size)
|
|
|
210 |
"""
|
211 |
|
212 |
@app.post("/upload/")
|
213 |
+
async def upload_file(file: UploadFile = File(...), padding_type: str = Form(...)):
|
214 |
try:
|
215 |
# Await file upload
|
216 |
contents = await file.read()
|
217 |
img = Image.open(BytesIO(contents)).convert("RGB")
|
218 |
+
# Apply padding based on user's choice
|
219 |
rectangled_img = fill_rectangle_cropper(img,padding_type)
|
220 |
|
221 |
# Save the rectangle image (original size)
|