Create folders chuncks and vocals if they not exist
Browse files
app.py
CHANGED
@@ -22,7 +22,6 @@ CONCATENATE_TRANSCRIPTIONS = False
|
|
22 |
TRANSLATE_TRANSCRIPTIONS = False
|
23 |
ADD_SUBTITLES_TO_VIDEO = False
|
24 |
REMOVE_FILES = False
|
25 |
-
REMOVE_ALL = False
|
26 |
if SEPARE_VOCALS:
|
27 |
SECONDS = 150
|
28 |
else:
|
@@ -197,26 +196,21 @@ def subtify_no_ui():
|
|
197 |
print("\n\n")
|
198 |
progress_bar.update(1)
|
199 |
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
os.system(command)
|
216 |
-
# command = f"rm videos/*"
|
217 |
-
# os.system(command)
|
218 |
-
command = f"rm vocals/*"
|
219 |
-
os.system(command)
|
220 |
|
221 |
# # def copy_url_from_clipboard():
|
222 |
# # return pyperclip.paste()
|
@@ -343,12 +337,16 @@ def get_audio_and_video_from_video(url, stream_page):
|
|
343 |
)
|
344 |
|
345 |
def trascribe_audio(audio_path, source_languaje):
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
python_file = "slice_audio.py"
|
347 |
command = f"python {python_file} {audio_path} {SECONDS}"
|
348 |
os.system(command)
|
349 |
|
350 |
-
folder_vocals = "vocals"
|
351 |
-
folder_chunck = "chunks"
|
352 |
with open(f"{folder_vocals}/speakers.txt", 'w') as f:
|
353 |
f.write(str(0))
|
354 |
command = f"mv {folder_chunck}/*.mp3 {folder_vocals}/"
|
@@ -444,8 +442,7 @@ def subtify():
|
|
444 |
with gr.Blocks() as demo:
|
445 |
# Layout
|
446 |
gr.Markdown("""# Subtify""")
|
447 |
-
gr.Markdown(""
|
448 |
-
gr.Markdown(f"Python: {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}")
|
449 |
# model = transformers.AutoModel.from_pretrained("huggingface/my_model")
|
450 |
# gr.Markdown(f"model.config.url: {model.config.url}")
|
451 |
token = os.getenv("HF_TOKEN")
|
@@ -520,10 +517,12 @@ def subtify():
|
|
520 |
if __name__ == "__main__":
|
521 |
parser = argparse.ArgumentParser()
|
522 |
parser.add_argument("--no_ui", action="store_true")
|
|
|
523 |
args = parser.parse_args()
|
524 |
|
525 |
if args.no_ui:
|
526 |
-
|
527 |
-
|
|
|
528 |
else:
|
529 |
subtify()
|
|
|
22 |
TRANSLATE_TRANSCRIPTIONS = False
|
23 |
ADD_SUBTITLES_TO_VIDEO = False
|
24 |
REMOVE_FILES = False
|
|
|
25 |
if SEPARE_VOCALS:
|
26 |
SECONDS = 150
|
27 |
else:
|
|
|
196 |
print("\n\n")
|
197 |
progress_bar.update(1)
|
198 |
|
199 |
+
def remove_all():
|
200 |
+
command = f"rm -r audios"
|
201 |
+
os.system(command)
|
202 |
+
command = f"rm -r chunks"
|
203 |
+
os.system(command)
|
204 |
+
command = f"rm -r concatenated_transcriptions"
|
205 |
+
os.system(command)
|
206 |
+
command = f"rm -r transcriptions"
|
207 |
+
os.system(command)
|
208 |
+
command = f"rm -r translated_transcriptions"
|
209 |
+
os.system(command)
|
210 |
+
command = f"rm -r videos"
|
211 |
+
os.system(command)
|
212 |
+
command = f"rm -r vocals"
|
213 |
+
os.system(command)
|
|
|
|
|
|
|
|
|
|
|
214 |
|
215 |
# # def copy_url_from_clipboard():
|
216 |
# # return pyperclip.paste()
|
|
|
337 |
)
|
338 |
|
339 |
def trascribe_audio(audio_path, source_languaje):
|
340 |
+
folder_vocals = "vocals"
|
341 |
+
folder_chunck = "chunks"
|
342 |
+
if not os.path.exists(folder_vocals):
|
343 |
+
os.makedirs(folder_vocals)
|
344 |
+
if not os.path.exists(folder_chunck):
|
345 |
+
os.makedirs(folder_chunck)
|
346 |
python_file = "slice_audio.py"
|
347 |
command = f"python {python_file} {audio_path} {SECONDS}"
|
348 |
os.system(command)
|
349 |
|
|
|
|
|
350 |
with open(f"{folder_vocals}/speakers.txt", 'w') as f:
|
351 |
f.write(str(0))
|
352 |
command = f"mv {folder_chunck}/*.mp3 {folder_vocals}/"
|
|
|
442 |
with gr.Blocks() as demo:
|
443 |
# Layout
|
444 |
gr.Markdown("""# Subtify""")
|
445 |
+
gr.Markdown("transcribe, Python: {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}")
|
|
|
446 |
# model = transformers.AutoModel.from_pretrained("huggingface/my_model")
|
447 |
# gr.Markdown(f"model.config.url: {model.config.url}")
|
448 |
token = os.getenv("HF_TOKEN")
|
|
|
517 |
if __name__ == "__main__":
|
518 |
parser = argparse.ArgumentParser()
|
519 |
parser.add_argument("--no_ui", action="store_true")
|
520 |
+
parser.add_argument("--remove_all", action="store_true")
|
521 |
args = parser.parse_args()
|
522 |
|
523 |
if args.no_ui:
|
524 |
+
subtify_no_ui()
|
525 |
+
elif args.remove_all:
|
526 |
+
remove_all()
|
527 |
else:
|
528 |
subtify()
|