Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

Create download_data.py

Zhaoyang Yufe3fca514a17
diff --git a/examples/aflow/data/download_data.py b/examples/aflow/data/download_data.py
new file mode 100644
index 000000000..a2214177f
--- /dev/null
+++ b/examples/aflow/data/download_data.py
@@ -0,0 +1,36 @@
+import os
+import requests
+import tarfile
+from tqdm import tqdm
+
+def download_file(url, filename):
+ response = requests.get(url, stream=True)
+ total_size = int(response.headers.get('content-length', 0))
+ block_size = 1024
+ progress_bar = tqdm(total=total_size, unit='iB', unit_scale=True)
+
+ with open(filename, 'wb') as file:
+ for data in response.iter_content(block_size):
+ size = file.write(data)
+ progress_bar.update(size)
+ progress_bar.close()
+
+def extract_tar_gz(filename, extract_path):
+ with tarfile.open(filename, 'r:gz') as tar:
+ tar.extractall(path=extract_path)
+
+url = "https://drive.google.com/uc?export=download&id=1tXp5cLw89egeKRwDuood2TPqoEWd8_C0"
+filename = "aflow_data.tar.gz"
+extract_path = "./"
+
+print("Downloading data file...")
+download_file(url, filename)
+
+print("Extracting data file...")
+extract_tar_gz(filename, extract_path)
+
+print("Download and extraction completed.")
+
+# Clean up the compressed file
+os.remove(filename)
+print(f"Removed {filename}")