Skip to content

Commit 5a56833

Browse files
committed
Merge branch 'update_install_for_pyenv' into development
2 parents 109f003 + a851640 commit 5a56833

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

gimpopenvino/plugins/openvino_utils/tools/model_manager.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,18 +343,20 @@ def compile_and_export_model(core, model_path, output_path, device='NPU', config
343343
tb_str = traceback.format_exc()
344344
raise RuntimeError(f"Model compilation or export failed for {model_path} on device {device}.\nDetails: {tb_str}")
345345

346-
def download_file_with_progress(url, local_filename, callback, total_bytes_downloaded, total_file_list_size):
346+
def download_file_with_progress(url, local_filename, callback, total_bytes_downloaded, total_file_list_size,total_file_size):
347347
response = requests.get(url, stream=True)
348-
total_size = int(response.headers.get('content-length', 0))
348+
total_size = int(total_file_size)
349349
downloaded_size = 0
350350

351+
percent_complete = 0
351352
percent_complete_last = -1.0;
352353
with open(local_filename, 'wb') as file:
353354
for data in response.iter_content(chunk_size=4096):
354355
file.write(data)
355356
downloaded_size += len(data)
356357
total_bytes_downloaded += len(data)
357-
percent_complete = (downloaded_size / total_size) * 100
358+
if total_size != 0:
359+
percent_complete = (downloaded_size / total_size) * 100
358360

359361
if percent_complete - percent_complete_last > 1:
360362
percent_complete_last = percent_complete
@@ -763,7 +765,7 @@ def bytes_downloaded_callback(total_bytes_downloaded, total_bytes_to_download):
763765
os.makedirs(subfolder, exist_ok=True)
764766

765767
#print("Downloading", download_list_item["url"], " to ", local_filename)
766-
downloaded_size = download_file_with_progress(download_list_item["url"], local_filename, bytes_downloaded_callback, total_bytes_downloaded, total_file_list_size)
768+
downloaded_size = download_file_with_progress(download_list_item["url"], local_filename, bytes_downloaded_callback, total_bytes_downloaded, total_file_list_size, download_list_item["size"])
767769

768770
if "cancelled" in self.model_install_status[model_id]:
769771
return True

install.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if /i "%script_dir%"=="%current_dir%" (
3434
echo **** openvino-ai-plugins-gimp Setup started ****
3535

3636
REM Create a virtual environment
37-
python -m venv gimpenv3
37+
call python -m venv gimpenv3
3838

3939
call "gimpenv3\Scripts\activate"
4040

0 commit comments

Comments
 (0)