ImPavloh commited on
Commit
c15280f
·
1 Parent(s): 5bdf75f

Update voiceit.py

Browse files
Files changed (1) hide show
  1. voiceit.py +9 -13
voiceit.py CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  import subprocess
2
  import shutil
3
  import time
@@ -6,16 +9,10 @@ import glob
6
  import json
7
  import os
8
 
9
- from pathlib import Path
10
- import gradio as gr
11
-
12
- from threading import Thread
13
- from pathlib import Path
14
-
15
- current_dir = os.path.dirname(os.path.abspath(__file__))
16
- MODELOS = os.path.join(current_dir, "modelos/")
17
- SEGMENTS_DIRNAME = os.path.join(current_dir, "segments")
18
- INFERENCE_OUTPUT_DIRNAME = os.path.join(current_dir, "inference_output")
19
 
20
  def slice_audio(filepath):
21
  assert os.path.exists(filepath), f"No se ha encontrado {filepath}."
@@ -23,7 +20,7 @@ def slice_audio(filepath):
23
  filename = filename.split("/")[-1]
24
  os.makedirs(SEGMENTS_DIRNAME, exist_ok=True)
25
  output_pattern = os.path.join(SEGMENTS_DIRNAME, f"{filename}_%d{extension}")
26
- os.system(f"ffmpeg -i {filepath} -f segment -segment_time 35 -c copy {output_pattern}")
27
 
28
  def get_container_format(filename):
29
  command = ["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries", "format=format_name", "-of", "default=noprint_wrappers=1:nokey=1", filename]
@@ -219,5 +216,4 @@ with gr.Blocks(
219
  """)
220
 
221
  if __name__ == "__main__":
222
- pavloh.queue(concurrency_count=3)
223
- pavloh.launch()
 
1
+ from threading import Thread
2
+ from pathlib import Path
3
+ import gradio as gr
4
  import subprocess
5
  import shutil
6
  import time
 
9
  import json
10
  import os
11
 
12
+ current_dir = Path(__file__).resolve().parent
13
+ MODELOS = current_dir / "modelos"
14
+ SEGMENTS_DIRNAME = current_dir / "segments"
15
+ INFERENCE_OUTPUT_DIRNAME = current_dir / "inference_output"
 
 
 
 
 
 
16
 
17
  def slice_audio(filepath):
18
  assert os.path.exists(filepath), f"No se ha encontrado {filepath}."
 
20
  filename = filename.split("/")[-1]
21
  os.makedirs(SEGMENTS_DIRNAME, exist_ok=True)
22
  output_pattern = os.path.join(SEGMENTS_DIRNAME, f"{filename}_%d{extension}")
23
+ os.system(f"ffmpeg -i {filepath} -f segment -segment_time 75 -c copy {output_pattern}")
24
 
25
  def get_container_format(filename):
26
  command = ["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries", "format=format_name", "-of", "default=noprint_wrappers=1:nokey=1", filename]
 
216
  """)
217
 
218
  if __name__ == "__main__":
219
+ pavloh.launch(enable_queue=True)