(url, destination)
| 27 | return magic, version |
| 28 | |
| 29 | def download_file(url, destination): |
| 30 | print(f"Downloading {url} to {destination}...") |
| 31 | response = requests.get(url, stream=True) |
| 32 | if response.status_code == 200: |
| 33 | with open(destination, 'wb') as f: |
| 34 | total_downloaded = 0 |
| 35 | for chunk in response.iter_content(chunk_size=1024): |
| 36 | if chunk: # filter out keep-alive new chunks |
| 37 | f.write(chunk) |
| 38 | total_downloaded += len(chunk) |
| 39 | if total_downloaded >= 10485760: # 10 MB |
| 40 | print('.', end='', flush=True) |
| 41 | total_downloaded = 0 |
| 42 | print("\nDownload complete.") |
| 43 | |
| 44 | # Creating a symbolic link from destination to "model.bin" |
| 45 | if os.path.isfile("model.bin"): |
| 46 | os.remove("model.bin") # remove the existing link if any |
| 47 | os.symlink(destination, "model.bin") |
| 48 | else: |
| 49 | print(f"Download failed with status code {response.status_code}") |
| 50 | |
| 51 | def get_user_choice(model_list): |
| 52 | # Print the enumerated list |
no outgoing calls
no test coverage detected
searching dependent graphs…