Upload complete dataset
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- get_image.py +91 -0
- hard_flash.json +0 -0
- images/00096722-9928-4464-bf91-e989fba184a2.jpg +3 -0
- images/0009b94d-c56e-4fdf-9110-8dd49afe239e.jpg +3 -0
- images/0009d7d9-9722-48ac-83af-7b51cca243ef.jpg +3 -0
- images/0016051c-36d8-4a82-8388-df1346407d0e.jpg +3 -0
- images/0016322b-4c3a-43bb-8b63-f78d572e79c0.jpg +3 -0
- images/001efd1e-2507-4c67-aef1-0f1760857c19.jpg +3 -0
- images/0020e78c-6252-4332-8909-881091b0f947.jpg +3 -0
- images/00246953-a41b-43d1-979e-237b39c858c0.jpg +3 -0
- images/002630b8-d960-45d5-8080-265693de902e.jpg +3 -0
- images/002688d3-c1d5-478f-b0cb-a406c4e4dd2b.jpg +3 -0
- images/0033adbb-7e22-4077-84b8-52058eaabfa2.jpg +3 -0
- images/004d4ef1-fac7-465d-bb59-14b6058a5f64.jpg +3 -0
- images/00530d4d-ce24-43db-9f1e-9ad40b9b01d4.jpg +3 -0
- images/00650dce-966a-4517-9c13-ed8e56f88fc8.jpg +3 -0
- images/006b779f-2e23-4eed-a3a4-69ad19619f7d.jpg +3 -0
- images/006fe9d7-0756-43b5-9d83-ecee666f1c9e.jpg +3 -0
- images/0076730b-de39-4e99-ae65-ee0114f1eb22.jpg +3 -0
- images/0079fa55-8fc1-46cb-a18a-18f7d92bede8.jpg +3 -0
- images/009684a8-e0d2-4626-985e-b4367ad10cd9.jpg +3 -0
- images/00a9df7a-0798-4b98-ab73-f79fabddc31b.jpg +3 -0
- images/00ae5b93-bde2-466a-ab63-8e1f116a462b.jpg +3 -0
- images/00c0bf2b-3fdd-4e53-9cdd-9459215d1a3d.jpg +3 -0
- images/00c6caa9-7d84-4317-bc27-149243cf8b33.jpg +3 -0
- images/00c96628-d4b9-4891-8d37-22028b37d2e4.jpg +3 -0
- images/00cf9930-9120-4c10-998c-e6f5b1fc403a.jpg +3 -0
- images/00cfc440-1b93-4cc3-84f4-37a70062cadc.jpg +3 -0
- images/00cfd72a-1ffb-43c8-b9aa-6d68f72c4dc7.jpg +3 -0
- images/00d1ab8c-e45e-481a-b6a9-6decf00b4348.jpg +3 -0
- images/00d1c5f7-5336-4ae8-bc32-523ba9511b28.jpg +3 -0
- images/00d21410-cfd5-41d6-ab12-b9226ffa54e0.jpg +3 -0
- images/00d36271-46c2-48bf-a525-ff68987f6771.jpg +3 -0
- images/00e8aeee-79e1-4eca-a348-e96f3ff78c0f.jpg +3 -0
- images/00f19b37-155c-4357-89d0-ac1f9e44f19f.jpg +3 -0
- images/010530d2-42b4-4036-911c-7127e12df916.jpg +3 -0
- images/010803cc-ceee-44e0-a4ae-afc0600609d7.jpg +3 -0
- images/010937f8-3309-4358-a7d5-0084527f8022.jpg +3 -0
- images/0110f7d4-2fc0-428e-baea-62c97abd485c.jpg +3 -0
- images/011c9cdf-4f82-48e1-8037-cecfce1debfd.jpg +3 -0
- images/012694cf-371f-44fa-aebc-0835d122d332.jpg +3 -0
- images/0131fc2f-f1a3-4864-bf08-80654e11779b.jpg +3 -0
- images/0133f3be-e07a-402a-8538-491df872ae23.jpg +3 -0
- images/0140a2bb-bfcc-4fb8-93a5-227b66bfbc1d.jpg +3 -0
- images/01431594-ddfd-44f6-bc83-0f31fd70e6c0.jpg +3 -0
- images/01462308-8fc4-4763-b665-d46cbae64edd.jpg +3 -0
- images/0148539a-6704-4bc8-b606-b9c57cd0f4f8.jpg +3 -0
- images/014c3c74-aba4-4e03-952e-05fdeccdeca5.jpg +3 -0
- images/014f9ca0-d7fe-47c6-ae40-2a61524c960e.jpg +3 -0
- images/01536db2-852a-42db-86eb-30a24fd1389c.jpg +3 -0
get_image.py
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import requests
|
3 |
+
import os
|
4 |
+
from concurrent.futures import ThreadPoolExecutor
|
5 |
+
from pathlib import Path
|
6 |
+
import time
|
7 |
+
from tqdm import tqdm
|
8 |
+
import logging
|
9 |
+
|
10 |
+
logging.basicConfig(
|
11 |
+
level=logging.INFO,
|
12 |
+
format='%(asctime)s - %(levelname)s - %(message)s'
|
13 |
+
)
|
14 |
+
logger = logging.getLogger(__name__)
|
15 |
+
|
16 |
+
def download_image(item):
|
17 |
+
image_id = item['image_id']
|
18 |
+
prompt = item['prompt']
|
19 |
+
url = f"https://api.recraft.ai/image/{image_id}"
|
20 |
+
|
21 |
+
output_dir = Path("downloaded_images")
|
22 |
+
output_dir.mkdir(exist_ok=True)
|
23 |
+
|
24 |
+
image_path = output_dir / f"{image_id}.jpg"
|
25 |
+
prompt_path = output_dir / f"{image_id}.txt"
|
26 |
+
|
27 |
+
try:
|
28 |
+
if image_path.exists() and prompt_path.exists():
|
29 |
+
logger.info(f"File exists, skipping: {image_id}")
|
30 |
+
return True
|
31 |
+
|
32 |
+
response = requests.get(url)
|
33 |
+
response.raise_for_status()
|
34 |
+
|
35 |
+
with open(image_path, 'wb') as f:
|
36 |
+
f.write(response.content)
|
37 |
+
|
38 |
+
with open(prompt_path, 'w', encoding='utf-8') as f:
|
39 |
+
f.write(prompt)
|
40 |
+
|
41 |
+
logger.debug(f"Successfully downloaded: {image_id}")
|
42 |
+
return True
|
43 |
+
except Exception as e:
|
44 |
+
logger.error(f"Download failed {image_id}: {str(e)}")
|
45 |
+
return False
|
46 |
+
|
47 |
+
def main():
|
48 |
+
print("=== Recraft Image Downloader ===")
|
49 |
+
|
50 |
+
if not Path('merged.json').exists():
|
51 |
+
logger.error("merged.json file not found!")
|
52 |
+
return
|
53 |
+
|
54 |
+
try:
|
55 |
+
with open('merged.json', 'r', encoding='utf-8') as f:
|
56 |
+
data = json.load(f)
|
57 |
+
except Exception as e:
|
58 |
+
logger.error(f"Failed to read JSON file: {str(e)}")
|
59 |
+
return
|
60 |
+
|
61 |
+
total_images = len(data['recraft_images'])
|
62 |
+
print(f"\nFound {total_images} images")
|
63 |
+
|
64 |
+
user_input = input("\nStart downloading? (y/n): ")
|
65 |
+
if user_input.lower() != 'y':
|
66 |
+
print("Download cancelled")
|
67 |
+
return
|
68 |
+
|
69 |
+
success_count = 0
|
70 |
+
start_time = time.time()
|
71 |
+
|
72 |
+
print("\nStarting download...")
|
73 |
+
with ThreadPoolExecutor(max_workers=10) as executor:
|
74 |
+
results = list(tqdm(
|
75 |
+
executor.map(download_image, data['recraft_images']),
|
76 |
+
total=total_images,
|
77 |
+
desc="Download Progress",
|
78 |
+
unit="images"
|
79 |
+
))
|
80 |
+
success_count = sum(results)
|
81 |
+
|
82 |
+
end_time = time.time()
|
83 |
+
|
84 |
+
print("\n=== Download Complete! ===")
|
85 |
+
print(f"Success: {success_count} images")
|
86 |
+
print(f"Failed: {total_images - success_count} images")
|
87 |
+
print(f"Total time: {end_time - start_time:.2f} seconds")
|
88 |
+
print(f"Average speed: {total_images / (end_time - start_time):.2f} images/sec")
|
89 |
+
|
90 |
+
if __name__ == "__main__":
|
91 |
+
main()
|
hard_flash.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
images/00096722-9928-4464-bf91-e989fba184a2.jpg
ADDED
Git LFS Details
|
images/0009b94d-c56e-4fdf-9110-8dd49afe239e.jpg
ADDED
Git LFS Details
|
images/0009d7d9-9722-48ac-83af-7b51cca243ef.jpg
ADDED
Git LFS Details
|
images/0016051c-36d8-4a82-8388-df1346407d0e.jpg
ADDED
Git LFS Details
|
images/0016322b-4c3a-43bb-8b63-f78d572e79c0.jpg
ADDED
Git LFS Details
|
images/001efd1e-2507-4c67-aef1-0f1760857c19.jpg
ADDED
Git LFS Details
|
images/0020e78c-6252-4332-8909-881091b0f947.jpg
ADDED
Git LFS Details
|
images/00246953-a41b-43d1-979e-237b39c858c0.jpg
ADDED
Git LFS Details
|
images/002630b8-d960-45d5-8080-265693de902e.jpg
ADDED
Git LFS Details
|
images/002688d3-c1d5-478f-b0cb-a406c4e4dd2b.jpg
ADDED
Git LFS Details
|
images/0033adbb-7e22-4077-84b8-52058eaabfa2.jpg
ADDED
Git LFS Details
|
images/004d4ef1-fac7-465d-bb59-14b6058a5f64.jpg
ADDED
Git LFS Details
|
images/00530d4d-ce24-43db-9f1e-9ad40b9b01d4.jpg
ADDED
Git LFS Details
|
images/00650dce-966a-4517-9c13-ed8e56f88fc8.jpg
ADDED
Git LFS Details
|
images/006b779f-2e23-4eed-a3a4-69ad19619f7d.jpg
ADDED
Git LFS Details
|
images/006fe9d7-0756-43b5-9d83-ecee666f1c9e.jpg
ADDED
Git LFS Details
|
images/0076730b-de39-4e99-ae65-ee0114f1eb22.jpg
ADDED
Git LFS Details
|
images/0079fa55-8fc1-46cb-a18a-18f7d92bede8.jpg
ADDED
Git LFS Details
|
images/009684a8-e0d2-4626-985e-b4367ad10cd9.jpg
ADDED
Git LFS Details
|
images/00a9df7a-0798-4b98-ab73-f79fabddc31b.jpg
ADDED
Git LFS Details
|
images/00ae5b93-bde2-466a-ab63-8e1f116a462b.jpg
ADDED
Git LFS Details
|
images/00c0bf2b-3fdd-4e53-9cdd-9459215d1a3d.jpg
ADDED
Git LFS Details
|
images/00c6caa9-7d84-4317-bc27-149243cf8b33.jpg
ADDED
Git LFS Details
|
images/00c96628-d4b9-4891-8d37-22028b37d2e4.jpg
ADDED
Git LFS Details
|
images/00cf9930-9120-4c10-998c-e6f5b1fc403a.jpg
ADDED
Git LFS Details
|
images/00cfc440-1b93-4cc3-84f4-37a70062cadc.jpg
ADDED
Git LFS Details
|
images/00cfd72a-1ffb-43c8-b9aa-6d68f72c4dc7.jpg
ADDED
Git LFS Details
|
images/00d1ab8c-e45e-481a-b6a9-6decf00b4348.jpg
ADDED
Git LFS Details
|
images/00d1c5f7-5336-4ae8-bc32-523ba9511b28.jpg
ADDED
Git LFS Details
|
images/00d21410-cfd5-41d6-ab12-b9226ffa54e0.jpg
ADDED
Git LFS Details
|
images/00d36271-46c2-48bf-a525-ff68987f6771.jpg
ADDED
Git LFS Details
|
images/00e8aeee-79e1-4eca-a348-e96f3ff78c0f.jpg
ADDED
Git LFS Details
|
images/00f19b37-155c-4357-89d0-ac1f9e44f19f.jpg
ADDED
Git LFS Details
|
images/010530d2-42b4-4036-911c-7127e12df916.jpg
ADDED
Git LFS Details
|
images/010803cc-ceee-44e0-a4ae-afc0600609d7.jpg
ADDED
Git LFS Details
|
images/010937f8-3309-4358-a7d5-0084527f8022.jpg
ADDED
Git LFS Details
|
images/0110f7d4-2fc0-428e-baea-62c97abd485c.jpg
ADDED
Git LFS Details
|
images/011c9cdf-4f82-48e1-8037-cecfce1debfd.jpg
ADDED
Git LFS Details
|
images/012694cf-371f-44fa-aebc-0835d122d332.jpg
ADDED
Git LFS Details
|
images/0131fc2f-f1a3-4864-bf08-80654e11779b.jpg
ADDED
Git LFS Details
|
images/0133f3be-e07a-402a-8538-491df872ae23.jpg
ADDED
Git LFS Details
|
images/0140a2bb-bfcc-4fb8-93a5-227b66bfbc1d.jpg
ADDED
Git LFS Details
|
images/01431594-ddfd-44f6-bc83-0f31fd70e6c0.jpg
ADDED
Git LFS Details
|
images/01462308-8fc4-4763-b665-d46cbae64edd.jpg
ADDED
Git LFS Details
|
images/0148539a-6704-4bc8-b606-b9c57cd0f4f8.jpg
ADDED
Git LFS Details
|
images/014c3c74-aba4-4e03-952e-05fdeccdeca5.jpg
ADDED
Git LFS Details
|
images/014f9ca0-d7fe-47c6-ae40-2a61524c960e.jpg
ADDED
Git LFS Details
|
images/01536db2-852a-42db-86eb-30a24fd1389c.jpg
ADDED
Git LFS Details
|