IRISLAB commited on
Commit
7b061c8
1 Parent(s): 0aa1dde

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -10,9 +10,16 @@ from modules.youtube_manager import get_ytmetas
10
  from modules.deepl_api import DeepLAPI
11
  from modules.whisper_parameter import *
12
 
 
 
 
 
 
 
13
 
14
  class App:
15
  def __init__(self, args):
 
16
  self.args = args
17
  self.app = gr.Blocks(css=CSS, theme=self.args.theme)
18
  self.whisper_inf = self.init_whisper()
@@ -303,7 +310,7 @@ class App:
303
  choices=self.nllb_inf.available_source_langs)
304
  dd_nllb_targetlang = gr.Dropdown(label="Target Language",
305
  choices=self.nllb_inf.available_target_langs)
306
- with gr.Row():
307
  cb_timestamp = gr.Checkbox(value=True, label="Add a timestamp to the end of the filename",
308
  interactive=True)
309
  with gr.Row():
@@ -355,6 +362,4 @@ _args = parser.parse_args()
355
 
356
  if __name__ == "__main__":
357
  app = App(args=_args)
358
- app.launch()
359
-
360
-
 
10
  from modules.deepl_api import DeepLAPI
11
  from modules.whisper_parameter import *
12
 
13
+ # Ensure the outputs directory exists
14
+ def ensure_output_directory():
15
+ output_directories = ["outputs", "outputs/translations"]
16
+ for directory in output_directories:
17
+ if not os.path.exists(directory):
18
+ os.makedirs(directory)
19
 
20
  class App:
21
  def __init__(self, args):
22
+ ensure_output_directory() # Making sure the output directories exist
23
  self.args = args
24
  self.app = gr.Blocks(css=CSS, theme=self.args.theme)
25
  self.whisper_inf = self.init_whisper()
 
310
  choices=self.nllb_inf.available_source_langs)
311
  dd_nllb_targetlang = gr.Dropdown(label="Target Language",
312
  choices=self.nllb_inf.available_target_langs)
313
+ with gr.Row():
314
  cb_timestamp = gr.Checkbox(value=True, label="Add a timestamp to the end of the filename",
315
  interactive=True)
316
  with gr.Row():
 
362
 
363
  if __name__ == "__main__":
364
  app = App(args=_args)
365
+ app.launch()