Update app.py
Browse files
app.py
CHANGED
@@ -302,10 +302,11 @@ class App:
|
|
302 |
with gr.TabItem("Audio upload/record"): # tab1
|
303 |
|
304 |
with gr.Row():
|
|
|
|
|
305 |
with gr.Column():
|
306 |
-
input_file = gr.Audio(type='filepath', elem_id="audio_input", show_download_button=True)
|
307 |
-
|
308 |
-
input_file_multi = gr.Files(label="Upload one or more audio/video files here", elem_id="audio_input", type='filepath', file_count="multiple", file_types=["audio","video"])
|
309 |
|
310 |
tb_input_folder = gr.Textbox(label="Input Folder Path (Optional)",
|
311 |
info="Optional: Specify the folder path where the input files are located, if you prefer to use local files instead of uploading them."
|
@@ -327,13 +328,15 @@ class App:
|
|
327 |
files_subtitles = gr.Files(label="Output data", interactive=False, file_count="multiple")
|
328 |
# btn_openfolder = gr.Button('📂', scale=1)
|
329 |
|
330 |
-
params = [
|
331 |
|
332 |
btn_run.click(fn=self.whisper_inf.transcribe_file,
|
333 |
inputs=params + whisper_params.as_list(),
|
334 |
outputs=[tb_indicator, files_subtitles, tb_info])
|
335 |
# btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
336 |
|
|
|
|
|
337 |
with gr.TabItem("Device info"): # tab2
|
338 |
with gr.Column():
|
339 |
gr.Markdown(device_info, label="Hardware info & installed packages")
|
@@ -369,6 +372,15 @@ class App:
|
|
369 |
else:
|
370 |
return gr.Checkbox(visible=True, value=False, label="Translate to English", interactive=True)
|
371 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
372 |
# Create the parser for command-line arguments
|
373 |
parser = argparse.ArgumentParser()
|
374 |
parser.add_argument('--whisper_type', type=str, default="faster-whisper",
|
|
|
302 |
with gr.TabItem("Audio upload/record"): # tab1
|
303 |
|
304 |
with gr.Row():
|
305 |
+
with gr.Column():
|
306 |
+
input_multi = gr.Radio(["Single", "Multi"], label="Process one or multiple files")
|
307 |
with gr.Column():
|
308 |
+
input_file = gr.Audio(type='filepath', elem_id="audio_input", show_download_button=True, visible=True)
|
309 |
+
input_file_multi = gr.Files(label="Upload one or more audio/video files here", elem_id="audio_input", type='filepath', file_count="multiple", file_types=["audio","video"], visible=False)
|
|
|
310 |
|
311 |
tb_input_folder = gr.Textbox(label="Input Folder Path (Optional)",
|
312 |
info="Optional: Specify the folder path where the input files are located, if you prefer to use local files instead of uploading them."
|
|
|
328 |
files_subtitles = gr.Files(label="Output data", interactive=False, file_count="multiple")
|
329 |
# btn_openfolder = gr.Button('📂', scale=1)
|
330 |
|
331 |
+
params = [input_file, tb_input_folder, dd_file_format, cb_timestamp_file, cb_translate_output, dd_translate_model, dd_target_lang, cb_timestamp_preview]
|
332 |
|
333 |
btn_run.click(fn=self.whisper_inf.transcribe_file,
|
334 |
inputs=params + whisper_params.as_list(),
|
335 |
outputs=[tb_indicator, files_subtitles, tb_info])
|
336 |
# btn_openfolder.click(fn=lambda: self.open_folder("outputs"), inputs=None, outputs=None)
|
337 |
|
338 |
+
input_multi.change(update_visibility,input_multi)
|
339 |
+
|
340 |
with gr.TabItem("Device info"): # tab2
|
341 |
with gr.Column():
|
342 |
gr.Markdown(device_info, label="Hardware info & installed packages")
|
|
|
372 |
else:
|
373 |
return gr.Checkbox(visible=True, value=False, label="Translate to English", interactive=True)
|
374 |
|
375 |
+
@staticmethod
|
376 |
+
def update_visibility(radio):
|
377 |
+
if radio == "Single":
|
378 |
+
input_file.visible = True
|
379 |
+
input_file_multi.visible = False
|
380 |
+
else:
|
381 |
+
input_file.visible = False
|
382 |
+
input_file_multi.visible = True
|
383 |
+
|
384 |
# Create the parser for command-line arguments
|
385 |
parser = argparse.ArgumentParser()
|
386 |
parser.add_argument('--whisper_type', type=str, default="faster-whisper",
|