Update app.py
Browse files
app.py
CHANGED
@@ -345,12 +345,7 @@ class App:
|
|
345 |
files_subtitles = gr.Files(label="Output data", interactive=False, file_count="multiple")
|
346 |
# btn_openfolder = gr.Button('📂', scale=1)
|
347 |
|
348 |
-
btn_download = gr.Button("Download results")
|
349 |
-
html_script = gr.HTML()
|
350 |
-
btn_download.click(fn=self.generate_download_script, inputs=[files_subtitles], outputs=[html_script])
|
351 |
-
|
352 |
params = [input_file_audio, input_file_video, input_file_multi, input_multi, tb_input_folder, dd_file_format, cb_timestamp_file, cb_translate_output, dd_translate_model, dd_target_lang, cb_timestamp_preview]
|
353 |
-
|
354 |
btn_run.click(fn=self.whisper_inf.transcribe_file,
|
355 |
inputs=params + whisper_params.as_list(),
|
356 |
outputs=[tb_indicator, files_subtitles, tb_info])
|
@@ -402,21 +397,6 @@ class App:
|
|
402 |
else:
|
403 |
return gr.update(visible=False), gr.update(visible=False), gr.update(visible=True)
|
404 |
|
405 |
-
@staticmethod
|
406 |
-
def generate_download_script(files):
|
407 |
-
js = "<script>\n"
|
408 |
-
for f in files:
|
409 |
-
filename = f.name.split("/")[-1]
|
410 |
-
js += f"""
|
411 |
-
var link = document.createElement('a');
|
412 |
-
link.href = '/file={f.name}';
|
413 |
-
link.download = '{filename}';
|
414 |
-
document.body.appendChild(link);
|
415 |
-
link.click();
|
416 |
-
document.body.removeChild(link);
|
417 |
-
"""
|
418 |
-
js += "</script>"
|
419 |
-
return js
|
420 |
|
421 |
# Create the parser for command-line arguments
|
422 |
parser = argparse.ArgumentParser()
|
|
|
345 |
files_subtitles = gr.Files(label="Output data", interactive=False, file_count="multiple")
|
346 |
# btn_openfolder = gr.Button('📂', scale=1)
|
347 |
|
|
|
|
|
|
|
|
|
348 |
params = [input_file_audio, input_file_video, input_file_multi, input_multi, tb_input_folder, dd_file_format, cb_timestamp_file, cb_translate_output, dd_translate_model, dd_target_lang, cb_timestamp_preview]
|
|
|
349 |
btn_run.click(fn=self.whisper_inf.transcribe_file,
|
350 |
inputs=params + whisper_params.as_list(),
|
351 |
outputs=[tb_indicator, files_subtitles, tb_info])
|
|
|
397 |
else:
|
398 |
return gr.update(visible=False), gr.update(visible=False), gr.update(visible=True)
|
399 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
|
401 |
# Create the parser for command-line arguments
|
402 |
parser = argparse.ArgumentParser()
|