Update app.py
Browse files
app.py
CHANGED
@@ -61,6 +61,30 @@ async def upload_image(url):
|
|
61 |
return {"error": str(e)}
|
62 |
|
63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
@app.get("/images_list")
|
65 |
async def get_images():
|
66 |
|
|
|
61 |
return {"error": str(e)}
|
62 |
|
63 |
|
64 |
+
@app.post("/palette_upload")
|
65 |
+
async def upload_image(url):
|
66 |
+
try:
|
67 |
+
options = UploadFileRequestOptions(
|
68 |
+
|
69 |
+
folder='/palette/',
|
70 |
+
overwrite_tags=False,
|
71 |
+
overwrite_custom_metadata=True,
|
72 |
+
custom_metadata={'testss': 12},
|
73 |
+
)
|
74 |
+
upload = imagekit.upload(
|
75 |
+
file=url,
|
76 |
+
file_name="palette.jpg",
|
77 |
+
#options=options
|
78 |
+
)
|
79 |
+
|
80 |
+
# Return the upload response
|
81 |
+
return {"message": "Uploaded successfully, check https://aiphotographer.github.io/photographer.html for your work!"}
|
82 |
+
except Exception as e:
|
83 |
+
return {"error": str(e)}
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
@app.get("/images_list")
|
89 |
async def get_images():
|
90 |
|