Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -241,10 +241,12 @@ def send_to_backend(image_buffer, user_id):
|
|
| 241 |
return "❌ user_id not found."
|
| 242 |
|
| 243 |
try:
|
| 244 |
-
# ✅
|
| 245 |
-
|
| 246 |
|
| 247 |
-
|
|
|
|
|
|
|
| 248 |
url = f"https://5a4d-103-40-74-78.ngrok-free.app/customisation/upload/{user_id}"
|
| 249 |
|
| 250 |
response = requests.post(url, files=files)
|
|
@@ -257,6 +259,7 @@ def send_to_backend(image_buffer, user_id):
|
|
| 257 |
except Exception as e:
|
| 258 |
return f"⚠️ Error: {str(e)}"
|
| 259 |
|
|
|
|
| 260 |
# Gradio interface
|
| 261 |
with gr.Blocks(title="Style Mixing for Clothing Design") as iface:
|
| 262 |
user_id_state = gr.State()
|
|
|
|
| 241 |
return "❌ user_id not found."
|
| 242 |
|
| 243 |
try:
|
| 244 |
+
# ✅ Convert BytesIO to raw bytes before sending
|
| 245 |
+
file_bytes = image_buffer.getvalue()
|
| 246 |
|
| 247 |
+
files = {'file': ('generated_image.png', file_bytes, 'image/png')}
|
| 248 |
+
|
| 249 |
+
# ✅ Update with your actual ngrok or server URL
|
| 250 |
url = f"https://5a4d-103-40-74-78.ngrok-free.app/customisation/upload/{user_id}"
|
| 251 |
|
| 252 |
response = requests.post(url, files=files)
|
|
|
|
| 259 |
except Exception as e:
|
| 260 |
return f"⚠️ Error: {str(e)}"
|
| 261 |
|
| 262 |
+
|
| 263 |
# Gradio interface
|
| 264 |
with gr.Blocks(title="Style Mixing for Clothing Design") as iface:
|
| 265 |
user_id_state = gr.State()
|