Update app.py
Browse files
app.py
CHANGED
|
@@ -26,8 +26,8 @@ CHANGE_CLOTHES_API = os.environ.get('CHANGE_CLOTHES_API', 'https://changeclothes
|
|
| 26 |
async def try_on(
|
| 27 |
human_img: UploadFile = File(...),
|
| 28 |
garment_img: UploadFile = File(...),
|
| 29 |
-
garment_desc: str = Form("
|
| 30 |
-
category: str = Form("
|
| 31 |
):
|
| 32 |
try:
|
| 33 |
# Generate unique filenames
|
|
@@ -71,7 +71,7 @@ async def try_on(
|
|
| 71 |
# Prepare headers, cookies, and data for the API
|
| 72 |
headers = {
|
| 73 |
"accept": "*/*",
|
| 74 |
-
"f": "sdfdsfsKaVgUoxa5j1jzcFtziPx", # Match Trinket
|
| 75 |
}
|
| 76 |
cookies = {}
|
| 77 |
data = {
|
|
@@ -81,10 +81,18 @@ async def try_on(
|
|
| 81 |
"category": category,
|
| 82 |
}
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
# Call the ChangeClothesAI API
|
| 85 |
-
logger.info(f"
|
| 86 |
response = requests.post(CHANGE_CLOTHES_API, headers=headers, cookies=cookies, data=data, timeout=60)
|
| 87 |
-
logger.info(f"API Response: {response.status_code}, {response.text}")
|
| 88 |
|
| 89 |
# Check if the API call was successful
|
| 90 |
if response.status_code != 200:
|
|
|
|
| 26 |
async def try_on(
|
| 27 |
human_img: UploadFile = File(...),
|
| 28 |
garment_img: UploadFile = File(...),
|
| 29 |
+
garment_desc: str = Form(""), # Match Trinket
|
| 30 |
+
category: str = Form("upper_body") # Match Trinket
|
| 31 |
):
|
| 32 |
try:
|
| 33 |
# Generate unique filenames
|
|
|
|
| 71 |
# Prepare headers, cookies, and data for the API
|
| 72 |
headers = {
|
| 73 |
"accept": "*/*",
|
| 74 |
+
"f": "sdfdsfsKaVgUoxa5j1jzcFtziPx", # Match Trinket
|
| 75 |
}
|
| 76 |
cookies = {}
|
| 77 |
data = {
|
|
|
|
| 81 |
"category": category,
|
| 82 |
}
|
| 83 |
|
| 84 |
+
# Test with Trinket URLs (uncomment to test)
|
| 85 |
+
# data = {
|
| 86 |
+
# "humanImg": "https://images.pexels.com/photos/1391498/pexels-photo-1391498.jpeg",
|
| 87 |
+
# "garment": "https://r2.changeclothesai.online/1752560324456537514.jpeg",
|
| 88 |
+
# "garmentDesc": "",
|
| 89 |
+
# "category": "upper_body"
|
| 90 |
+
# }
|
| 91 |
+
|
| 92 |
# Call the ChangeClothesAI API
|
| 93 |
+
logger.info(f"Sending API request: URL={CHANGE_CLOTHES_API}, Headers={headers}, Data={data}")
|
| 94 |
response = requests.post(CHANGE_CLOTHES_API, headers=headers, cookies=cookies, data=data, timeout=60)
|
| 95 |
+
logger.info(f"API Response: Status={response.status_code}, Body={response.text}, Headers={response.headers}")
|
| 96 |
|
| 97 |
# Check if the API call was successful
|
| 98 |
if response.status_code != 200:
|