Skip to content

Commit

Permalink
EasyPhoto add s3 dowm
Browse files Browse the repository at this point in the history
  • Loading branch information
Lassi-KK committed Feb 5, 2024
1 parent 264e4bd commit 3be1ade
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,12 +934,14 @@ def invocations(self, req: models.InvocationsRequest):
reload_vae_weights()

# Train
user_path = f'./datasets/{req.id}'
if req.s3Url !='':
shared.download_dataset_from_s3(req.s3Url, f'./datasets/{req.id}')
shared.download_dataset_from_s3(req.s3Url, user_path)

img_list = f'./datasets/{req.id}'
img_list = os.listdir(user_path)
encoded_images = []
for idx, img_path in enumerate(img_list):
img_path = os.path.join(user_path, img_path)
with open(img_path, "rb") as f:
encoded_image = base64.b64encode(f.read()).decode("utf-8")
encoded_images.append(encoded_image)
Expand Down

0 comments on commit 3be1ade

Please sign in to comment.