Spaces:
Running
Running
Update fluxai.py
Browse files
fluxai.py
CHANGED
@@ -75,7 +75,7 @@ def deduct_tokens_gpt(user_id, amount):
|
|
75 |
else:
|
76 |
return False
|
77 |
|
78 |
-
UPLOAD_DIRECTORY = "uploads"
|
79 |
|
80 |
@router.get("/uploads/{filename}")
|
81 |
async def get_upload(filename: str):
|
@@ -121,7 +121,7 @@ async def fluxai_image(payload: FluxAI):
|
|
121 |
image.save(enhanced_image_bytes, format="JPEG", quality=95)
|
122 |
enhanced_image_bytes.seek(0)
|
123 |
unique_filename = f"{uuid.uuid4().hex}.jpg"
|
124 |
-
file_path = os.path.join(
|
125 |
os.makedirs(os.path.dirname(file_path), exist_ok=True)
|
126 |
with open(file_path, "wb") as f:
|
127 |
f.write(enhanced_image_bytes.getvalue())
|
|
|
75 |
else:
|
76 |
return False
|
77 |
|
78 |
+
UPLOAD_DIRECTORY = "./uploads"
|
79 |
|
80 |
@router.get("/uploads/{filename}")
|
81 |
async def get_upload(filename: str):
|
|
|
121 |
image.save(enhanced_image_bytes, format="JPEG", quality=95)
|
122 |
enhanced_image_bytes.seek(0)
|
123 |
unique_filename = f"{uuid.uuid4().hex}.jpg"
|
124 |
+
file_path = os.path.join(UPLOAD_DIRECTORY, unique_filename)
|
125 |
os.makedirs(os.path.dirname(file_path), exist_ok=True)
|
126 |
with open(file_path, "wb") as f:
|
127 |
f.write(enhanced_image_bytes.getvalue())
|