TheLastBen
commited on
Commit
·
fb3fac6
1
Parent(s):
c600377
Update Scripts/mainpaperspacev1.py
Browse files- Scripts/mainpaperspacev1.py +10 -7
Scripts/mainpaperspacev1.py
CHANGED
@@ -389,14 +389,16 @@ def upld(Remove_existing_instance_images, Crop_images, Crop_size, IMAGES_FOLDER_
|
|
389 |
|
390 |
elif IMAGES_FOLDER_OPTIONAL =="":
|
391 |
up=""
|
392 |
-
for
|
|
|
393 |
if filename.split(".")[-1]=="txt":
|
394 |
with open(CAPTIONS_DIR+'/'+filename, 'w') as f:
|
395 |
f.write(file['content'].decode())
|
396 |
-
up=[
|
397 |
if Crop_images:
|
398 |
-
for
|
399 |
-
|
|
|
400 |
extension = filename.split(".")[-1]
|
401 |
identifier=filename.split(".")[0]
|
402 |
|
@@ -418,8 +420,9 @@ def upld(Remove_existing_instance_images, Crop_images, Crop_size, IMAGES_FOLDER_
|
|
418 |
image[0].save(new_path_with_file, format=extension.upper())
|
419 |
|
420 |
else:
|
421 |
-
for
|
422 |
-
|
|
|
423 |
|
424 |
extension = filename.split(".")[-1]
|
425 |
identifier=filename.split(".")[0]
|
@@ -428,7 +431,7 @@ def upld(Remove_existing_instance_images, Crop_images, Crop_size, IMAGES_FOLDER_
|
|
428 |
img=img.convert("RGB")
|
429 |
img.save(INSTANCE_DIR+"/"+filename, format="JPEG", quality = 100)
|
430 |
else:
|
431 |
-
img.save(INSTANCE_DIR+"/"+filename, format=extension.upper())
|
432 |
|
433 |
if ren:
|
434 |
i=0
|
|
|
389 |
|
390 |
elif IMAGES_FOLDER_OPTIONAL =="":
|
391 |
up=""
|
392 |
+
for file in uploader.value:
|
393 |
+
filename = file['name']
|
394 |
if filename.split(".")[-1]=="txt":
|
395 |
with open(CAPTIONS_DIR+'/'+filename, 'w') as f:
|
396 |
f.write(file['content'].decode())
|
397 |
+
up=[file for file in uploader.value if filename.split(".")[-1]!="txt"]
|
398 |
if Crop_images:
|
399 |
+
for file in tqdm(up, bar_format=' |{bar:15}| {n_fmt}/{total_fmt} Uploaded'):
|
400 |
+
filename = file['name']
|
401 |
+
img = Image.open(io.BytesIO(file['content']))
|
402 |
extension = filename.split(".")[-1]
|
403 |
identifier=filename.split(".")[0]
|
404 |
|
|
|
420 |
image[0].save(new_path_with_file, format=extension.upper())
|
421 |
|
422 |
else:
|
423 |
+
for file in tqdm(uploader.value, bar_format=' |{bar:15}| {n_fmt}/{total_fmt} Uploaded'):
|
424 |
+
filename = file['name']
|
425 |
+
img = Image.open(io.BytesIO(file['content']))
|
426 |
|
427 |
extension = filename.split(".")[-1]
|
428 |
identifier=filename.split(".")[0]
|
|
|
431 |
img=img.convert("RGB")
|
432 |
img.save(INSTANCE_DIR+"/"+filename, format="JPEG", quality = 100)
|
433 |
else:
|
434 |
+
img.save(INSTANCE_DIR+"/"+filename, format=extension.upper())
|
435 |
|
436 |
if ren:
|
437 |
i=0
|