Skip to content

Commit

Permalink
work around new gradio 5 behaviour (#498)
Browse files Browse the repository at this point in the history
Co-authored-by: Josef Haupt <[email protected]>
  • Loading branch information
Josef-Haupt and Josef Haupt authored Nov 1, 2024
1 parent bac36f6 commit a128d54
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion birdnet_analyzer/gui/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,12 @@ def on_custom_classifier_selection_click():
)


def _get_win_drives():
from string import ascii_uppercase as UPPER_CASE

return [f"{drive}:\\" for drive in UPPER_CASE]


def open_window(builder: list[Callable] | Callable):
multiprocessing.freeze_support()

Expand All @@ -497,7 +503,13 @@ def open_window(builder: list[Callable] | Callable):
build_settings()
build_footer()

url = demo.queue(api_open=False).launch(prevent_thread_lock=True, quiet=True, show_api=False, enable_monitoring=False)[1]
url = demo.queue(api_open=False).launch(
prevent_thread_lock=True,
quiet=True,
show_api=False,
enable_monitoring=False,
allowed_paths=_get_win_drives() if sys.platform == "win32" else ["/"],
)[1]
_WINDOW = webview.create_window("BirdNET-Analyzer", url.rstrip("/") + "?__theme=light", min_size=(1024, 768))
set_window(_WINDOW)

Expand Down

0 comments on commit a128d54

Please sign in to comment.