From 775e2a60693150667652fdda9861993fbc292506 Mon Sep 17 00:00:00 2001 From: Josef Haupt Date: Mon, 8 Jan 2024 15:51:15 +0100 Subject: [PATCH] use gradio tmp file manually without preprocess (#222) Co-authored-by: Josef Haupt --- gui.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gui.py b/gui.py index 156cedc1..44e4e690 100644 --- a/gui.py +++ b/gui.py @@ -773,7 +773,8 @@ def on_custom_classifier_selection_click(): def build_single_analysis_tab(): with gr.Tab("Single file"): - audio_input = gr.Audio(type="filepath", label="file") + audio_input = gr.Audio(type="filepath", label="file", sources=["upload"]) + audio_path_state = gr.State() confidence_slider, sensitivity_slider, overlap_slider = sample_sliders(False) ( @@ -788,8 +789,13 @@ def build_single_analysis_tab(): ) = species_lists(False) locale_radio = locale() + def get_audio_path(i): + return i["path"] if i else None + + audio_input.change(get_audio_path, inputs=audio_input, outputs=audio_path_state, preprocess=False) + inputs = [ - audio_input, + audio_path_state, confidence_slider, sensitivity_slider, overlap_slider,