Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions birdnet_analyzer/gui/assets/gui.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,20 @@ footer {
resize: none !important;
text-overflow: ellipsis !important;
text-align: left !important;
}

.info-accordion-dark {
background-color: #2980b9;
}

.info-accordion {
background-color: rgba(17, 38, 224, 0.6);
}

.info-accordion p {
color: white;
}

.info-accordion button {
color: white;
}
7 changes: 6 additions & 1 deletion birdnet_analyzer/gui/embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ def build_embeddings_tab() -> gu.TAB_BUILDER_RESULT:
input_directory_state = gr.State()
db_directory_state = gr.State()

gu.info_box(
description=loc.localize("embeddings-tab-info-text"),
title=loc.localize("embeddings-tab-info-title"),
)

def select_directory_to_state_and_tb(current, state_key=None):
path = (
gu.select_directory(collect_files=False, state_key=state_key)
Expand Down Expand Up @@ -324,7 +329,7 @@ def select_file_output_directory_and_update_tb(current):

progress_plot = gr.Plot(show_label=False)
start_btn = gr.Button(
loc.localize("embeddings-tab-start-button-label"), variant="huggingface"
loc.localize("embeddings-tab-start-button-label"), variant="primary"
)

start_btn.click(
Expand Down
7 changes: 6 additions & 1 deletion birdnet_analyzer/gui/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,11 @@ def update_selections(
prediction_files_state = gr.State()
plot_name_state = gr.State()

gu.info_box(
description=loc.localize("eval-tab-info-text"),
title=loc.localize("eval-tab-info-title"),
)

def get_selection_tables(directory):
from pathlib import Path

Expand Down Expand Up @@ -668,7 +673,7 @@ def select_directory_on_empty():

calculate_button = gr.Button(
loc.localize("eval-tab-calculate-metrics-button-label"),
variant="huggingface",
variant="primary",
)

with gr.Column(visible=False) as action_col:
Expand Down
7 changes: 6 additions & 1 deletion birdnet_analyzer/gui/multi_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ def build_multi_analysis_tab() -> gu.TAB_BUILDER_RESULT:
input_directory_state = gr.State()
output_directory_predict_state = gr.State()

gu.info_box(
description=loc.localize("multi-tab-info-text"),
title=loc.localize("multi-tab-info-title"),
)

with gr.Group(), gr.Row(equal_height=True):
select_directory_btn = gr.Button(
loc.localize("multi-tab-input-selection-button-label"),
Expand Down Expand Up @@ -222,7 +227,7 @@ def select_directory_wrapper():

bs_number, producers_number, workers_number = gu.computing_settings()
start_batch_analysis_btn = gr.Button(
loc.localize("analyze-start-button-label"), variant="huggingface"
loc.localize("analyze-start-button-label"), variant="primary"
)
result_grid = gr.List(headers=[""])
inputs = [
Expand Down
5 changes: 5 additions & 0 deletions birdnet_analyzer/gui/review.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ def create_log_plot(positives, negatives, fig_num=None):
}
)

gu.info_box(
description=loc.localize("review-tab-info-text"),
title=loc.localize("review-tab-info-title"),
)

select_directory_btn = gr.Button(
loc.localize("review-tab-input-directory-button-label")
)
Expand Down
7 changes: 6 additions & 1 deletion birdnet_analyzer/gui/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ def build_search_tab() -> gu.TAB_BUILDER_RESULT:
export_state = gr.State({})
hidden_audio = gr.Audio(visible="hidden", autoplay=True, type="numpy")

gu.info_box(
description=loc.localize("embeddings-search-tab-info-text"),
title=loc.localize("embeddings-search-tab-info-title"),
)

with gr.Row():
with gr.Column():
with gr.Group(), gr.Row(equal_height=True):
Expand Down Expand Up @@ -236,7 +241,7 @@ def build_search_tab() -> gu.TAB_BUILDER_RESULT:
)
search_btn = gr.Button(
loc.localize("embeddings-search-start-button-label"),
variant="huggingface",
variant="primary",
)

with gr.Column():
Expand Down
7 changes: 6 additions & 1 deletion birdnet_analyzer/gui/segments.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ def build_segments_tab() -> gu.TAB_BUILDER_RESULT:
result_directory_state = gr.State()
output_directory_state = gr.State()

gu.info_box(
description=loc.localize("segments-tab-info-text"),
title=loc.localize("segments-tab-info-title"),
)

def select_directory_to_state_and_tb(state_key):
selection = gu.select_directory(collect_files=False, state_key=state_key)
if selection:
Expand Down Expand Up @@ -244,7 +249,7 @@ def select_directory_to_state_and_tb(state_key):
)

extract_segments_btn = gr.Button(
loc.localize("segments-tab-extract-button-label"), variant="huggingface"
loc.localize("segments-tab-extract-button-label"), variant="primary"
)
result_grid = gr.List(headers=[""])

Expand Down
4 changes: 2 additions & 2 deletions birdnet_analyzer/gui/single_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def build_single_analysis_tab() -> gu.TAB_BUILDER_RESULT:

single_file_analyze = gr.Button(
loc.localize("analyze-start-button-label"),
variant="huggingface",
variant="primary",
interactive=False,
)

Expand Down Expand Up @@ -304,7 +304,7 @@ def try_generate_spectrogram(audio_path, generate_spectrogram):
try_generate_spectrogram,
inputs=[audio_path_state, generate_spectrogram_cb],
outputs=[spectrogram_group, spectrogram_output],
show_progress_on=generate_spectrogram_cb
show_progress_on=generate_spectrogram_cb,
)

select_file_button.click(
Expand Down
7 changes: 6 additions & 1 deletion birdnet_analyzer/gui/species.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ def build_species_tab() -> gu.TAB_BUILDER_RESULT:
with gr.Tab(loc.localize("species-tab-title")) as species_tab:
output_directory_state = gr.State()

gu.info_box(
description=loc.localize("species-tab-info-text"),
title=loc.localize("species-tab-info-title"),
)

with gr.Group(), gr.Row(equal_height=True):
select_directory_btn = gr.Button(
loc.localize("species-tab-select-output-directory-button-label"),
Expand Down Expand Up @@ -86,7 +91,7 @@ def select_directory_and_update_tb(name_tb):
locale = gu.locale()

start_btn = gr.Button(
loc.localize("species-tab-start-button-label"), variant="huggingface"
loc.localize("species-tab-start-button-label"), variant="primary"
)
start_btn.click(
run_species_list,
Expand Down
7 changes: 6 additions & 1 deletion birdnet_analyzer/gui/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ def build_train_tab() -> gu.TAB_BUILDER_RESULT:
output_directory_state = gr.State()
test_data_dir_state = gr.State()

gu.info_box(
description=loc.localize("training-tab-info-text"),
title=loc.localize("training-tab-info-title"),
)

with gr.Group(), gr.Row(equal_height=True):
select_directory_btn = gr.Button(
loc.localize("training-tab-input-selection-button-label"),
Expand Down Expand Up @@ -808,7 +813,7 @@ def on_autotune_change(value):
)
start_training_button = gr.Button(
loc.localize("training-tab-start-training-button-label"),
variant="huggingface",
variant="primary",
)

def train_and_show_metrics(*args):
Expand Down
19 changes: 18 additions & 1 deletion birdnet_analyzer/gui/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import warnings
from collections.abc import Callable
from contextlib import suppress
from html import escape
from typing import Literal, cast, get_args

import gradio as gr
Expand Down Expand Up @@ -1017,6 +1018,22 @@ def computing_settings():
return bs_number, producers_number, workers_number


def info_box(description: str, title="Info") -> gr.HTML:
title = escape(title)
description = escape(description)

with gr.Accordion(
title,
elem_classes="info-accordion-dark"
if settings.theme() == "dark"
else "info-accordion",
open=False,
) as c:
gr.Markdown(description)

return c


def slider_to_value(value: float):
return max(0.1, 1.0 / (value * -1)) if value < 0 else max(1.0, float(value))

Expand Down Expand Up @@ -1111,4 +1128,4 @@ def update_plots(*args):
ctypes.sizeof(wintypes.BOOL),
)

webview.start(private_mode=False)
webview.start(private_mode=False, debug=True)
18 changes: 17 additions & 1 deletion birdnet_analyzer/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -389,5 +389,21 @@
"validation-no-valid-classifier-name": "Bitte geben Sie einen gültigen Namen für den Klassifikator an.",
"validation-no-valid-epoch-number": "Bitte geben Sie eine gültige Anzahl von Epochen an.",
"validation-no-valid-frequency": "Bitte geben Sie eine gültige Frequenz an",
"validation-no-valid-learning-rate": "Bitte geben Sie eine gültige Lernrate an."
"validation-no-valid-learning-rate": "Bitte geben Sie eine gültige Lernrate an.",
"multi-tab-info-text": "Analyze all audio files in a directory recursively. Select an input folder, review the sample list, choose an output location and result formats, adjust settings if needed, then start the batch run.",
"multi-tab-info-title": "Info",
"embeddings-search-tab-info-text": "Search an embeddings database with a query sample. Select the database and audio root, choose a query clip, tune the search options, then review or export the closest matches.",
"embeddings-search-tab-info-title": "Info",
"embeddings-tab-info-text": "Build an embeddings database from a directory of audio files. Choose the source audio and database location, adjust settings if needed, then generate the database for later search and review.",
"embeddings-tab-info-title": "Info",
"eval-tab-info-text": "Compare prediction files against annotations. Upload both sets, confirm the column mapping, calculate the metrics, then inspect plots and export the result tables if needed.",
"eval-tab-info-title": "Info",
"review-tab-info-text": "Review extracted segments one species at a time. Select a directory, step through the clips, mark each item as positive or negative, and use the history and regression plot to track progress.",
"review-tab-info-title": "Info",
"segments-tab-info-text": "Extract segments from analysis results. Select the source audio, result files, and output folder, set the collection filters, then create a segment set for review or training.",
"segments-tab-info-title": "Info",
"species-tab-info-text": "Generate a species list for a location. Choose where to save the file, set the coordinates and seasonal filters, then export the list for later analysis.",
"species-tab-info-title": "Info",
"training-tab-info-text": "Train a custom classifier from labeled folders. Select the training data and output location, optionally add test data and preprocessing settings, then run training and review the metrics.",
"training-tab-info-title": "Info"
}
18 changes: 17 additions & 1 deletion birdnet_analyzer/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@
"multi-tab-additional-column-week-label": "Week",
"multi-tab-additional-columns-checkbox-info": "Adds additional columns to the output. \"Start (s)\", \"End (s)\", \"Scientific name\", \"Common name\", \"Confidence\", \"File\" are already included.",
"multi-tab-additional-columns-checkbox-label": "Additional columns for CSV",
"multi-tab-info-text": "Analyze all audio files in a directory recursively. Select an input folder, review the sample list, choose an output location and result formats, adjust settings if needed, then start the batch run.",
"multi-tab-info-title": "Info",
"multi-tab-input-selection-button-label": "Select input directory (recursive)",
"multi-tab-input-selection-textbox-placeholder": "No input directory selected",
"multi-tab-more-files-label": "more...",
Expand Down Expand Up @@ -389,5 +391,19 @@
"validation-no-valid-classifier-name": "Please enter a valid name for the classifier.",
"validation-no-valid-epoch-number": "Please enter a valid number of epochs.",
"validation-no-valid-frequency": "Please enter a valid frequency in",
"validation-no-valid-learning-rate": "Please enter a valid learning rate."
"validation-no-valid-learning-rate": "Please enter a valid learning rate.",
"embeddings-search-tab-info-text": "Search an embeddings database with a query sample. Select the database and audio root, choose a query clip, tune the search options, then review or export the closest matches.",
"embeddings-search-tab-info-title": "Info",
"embeddings-tab-info-text": "Build an embeddings database from a directory of audio files. Choose the source audio and database location, adjust settings if needed, then generate the database for later search and review.",
"embeddings-tab-info-title": "Info",
"eval-tab-info-text": "Compare prediction files against annotations. Upload both sets, confirm the column mapping, calculate the metrics, then inspect plots and export the result tables if needed.",
"eval-tab-info-title": "Info",
"review-tab-info-text": "Review extracted segments one species at a time. Select a directory, step through the clips, mark each item as positive or negative, and use the history and regression plot to track progress.",
"review-tab-info-title": "Info",
"segments-tab-info-text": "Extract segments from analysis results. Select the source audio, result files, and output folder, set the collection filters, then create a segment set for review or training.",
"segments-tab-info-title": "Info",
"species-tab-info-text": "Generate a species list for a location. Choose where to save the file, set the coordinates and seasonal filters, then export the list for later analysis.",
"species-tab-info-title": "Info",
"training-tab-info-text": "Train a custom classifier from labeled folders. Select the training data and output location, optionally add test data and preprocessing settings, then run training and review the metrics.",
"training-tab-info-title": "Info"
}
18 changes: 17 additions & 1 deletion birdnet_analyzer/lang/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -389,5 +389,21 @@
"validation-no-valid-classifier-name": "Anna kelvollinen nimi luokittelijalle.",
"validation-no-valid-epoch-number": "Anna kelvollinen aikakausien määrä.",
"validation-no-valid-frequency": "Anna kelvollinen taajuus",
"validation-no-valid-learning-rate": "Anna kelvollinen oppimistahti."
"validation-no-valid-learning-rate": "Anna kelvollinen oppimistahti.",
"multi-tab-info-text": "Analyze all audio files in a directory recursively. Select an input folder, review the sample list, choose an output location and result formats, adjust settings if needed, then start the batch run.",
"multi-tab-info-title": "Info",
"embeddings-search-tab-info-text": "Search an embeddings database with a query sample. Select the database and audio root, choose a query clip, tune the search options, then review or export the closest matches.",
"embeddings-search-tab-info-title": "Info",
"embeddings-tab-info-text": "Build an embeddings database from a directory of audio files. Choose the source audio and database location, adjust settings if needed, then generate the database for later search and review.",
"embeddings-tab-info-title": "Info",
"eval-tab-info-text": "Compare prediction files against annotations. Upload both sets, confirm the column mapping, calculate the metrics, then inspect plots and export the result tables if needed.",
"eval-tab-info-title": "Info",
"review-tab-info-text": "Review extracted segments one species at a time. Select a directory, step through the clips, mark each item as positive or negative, and use the history and regression plot to track progress.",
"review-tab-info-title": "Info",
"segments-tab-info-text": "Extract segments from analysis results. Select the source audio, result files, and output folder, set the collection filters, then create a segment set for review or training.",
"segments-tab-info-title": "Info",
"species-tab-info-text": "Generate a species list for a location. Choose where to save the file, set the coordinates and seasonal filters, then export the list for later analysis.",
"species-tab-info-title": "Info",
"training-tab-info-text": "Train a custom classifier from labeled folders. Select the training data and output location, optionally add test data and preprocessing settings, then run training and review the metrics.",
"training-tab-info-title": "Info"
}
18 changes: 17 additions & 1 deletion birdnet_analyzer/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -389,5 +389,21 @@
"validation-no-valid-classifier-name": "Veuillez saisir un nom valide pour le classificateur.",
"validation-no-valid-epoch-number": "Veuillez saisir un nombre valide d'époques.",
"validation-no-valid-frequency": "Veuillez saisir une fréquence valide dans",
"validation-no-valid-learning-rate": "Veuillez saisir un taux d'apprentissage valide."
"validation-no-valid-learning-rate": "Veuillez saisir un taux d'apprentissage valide.",
"multi-tab-info-text": "Analyze all audio files in a directory recursively. Select an input folder, review the sample list, choose an output location and result formats, adjust settings if needed, then start the batch run.",
"multi-tab-info-title": "Info",
"embeddings-search-tab-info-text": "Search an embeddings database with a query sample. Select the database and audio root, choose a query clip, tune the search options, then review or export the closest matches.",
"embeddings-search-tab-info-title": "Info",
"embeddings-tab-info-text": "Build an embeddings database from a directory of audio files. Choose the source audio and database location, adjust settings if needed, then generate the database for later search and review.",
"embeddings-tab-info-title": "Info",
"eval-tab-info-text": "Compare prediction files against annotations. Upload both sets, confirm the column mapping, calculate the metrics, then inspect plots and export the result tables if needed.",
"eval-tab-info-title": "Info",
"review-tab-info-text": "Review extracted segments one species at a time. Select a directory, step through the clips, mark each item as positive or negative, and use the history and regression plot to track progress.",
"review-tab-info-title": "Info",
"segments-tab-info-text": "Extract segments from analysis results. Select the source audio, result files, and output folder, set the collection filters, then create a segment set for review or training.",
"segments-tab-info-title": "Info",
"species-tab-info-text": "Generate a species list for a location. Choose where to save the file, set the coordinates and seasonal filters, then export the list for later analysis.",
"species-tab-info-title": "Info",
"training-tab-info-text": "Train a custom classifier from labeled folders. Select the training data and output location, optionally add test data and preprocessing settings, then run training and review the metrics.",
"training-tab-info-title": "Info"
}
Loading
Loading