Skip to content

Commit 3f94e83

Browse files
authored
Add progress reporting for downloading execution provider (#696)
This pull request adds progress reporting for the execution provider download step in `app.py`. The main change is the introduction of a callback function to display real-time progress updates during the download and registration of execution providers. **Execution provider progress reporting:** * Added a `_ep_progress` callback function to print real-time progress for each execution provider being downloaded and registered, and integrated it with `manager.download_and_register_eps`.
1 parent 8521722 commit 3f94e83

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

  • samples/python/web-server-responses-vision/src

samples/python/web-server-responses-vision/src/app.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,23 @@ def resize_and_encode(path, max_dim=512):
3535
config = Configuration(app_name="foundry_local_samples")
3636
FoundryLocalManager.initialize(config)
3737
manager = FoundryLocalManager.instance
38+
39+
current_ep = ""
40+
41+
42+
def _ep_progress(ep_name: str, percent: float):
43+
global current_ep
44+
if ep_name != current_ep:
45+
if current_ep:
46+
print()
47+
current_ep = ep_name
48+
print(f"\r {ep_name:<30} {percent:5.1f}%", end="", flush=True)
49+
50+
51+
print("\nDownloading execution providers:")
52+
manager.download_and_register_eps(progress_callback=_ep_progress)
53+
if current_ep:
54+
print()
3855
# </init>
3956

4057
# <model_setup>

0 commit comments

Comments
 (0)