If use on CPU change SECONDS of chuncks and print RAM of the machine
Browse files
app.py
CHANGED
@@ -13,6 +13,7 @@ import urllib.request
|
|
13 |
|
14 |
NUMBER = 100
|
15 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
16 |
DOWNLOAD = True
|
17 |
SLICE_AUDIO = True
|
18 |
TRANSCRIBE_AUDIO = True
|
@@ -22,8 +23,14 @@ ADD_SUBTITLES_TO_VIDEO = True
|
|
22 |
REMOVE_FILES = True
|
23 |
if DEVICE == "cpu":
|
24 |
# I supose that I am on huggingface server
|
25 |
-
|
|
|
|
|
|
|
|
|
26 |
else:
|
|
|
|
|
27 |
SECONDS = 300
|
28 |
|
29 |
YOUTUBE = "youtube"
|
@@ -158,7 +165,7 @@ html_buy_me_a_coffe = '''
|
|
158 |
language_dict = union_language_dict()
|
159 |
|
160 |
def subtify_no_ui():
|
161 |
-
number_works =
|
162 |
progress_bar = tqdm(total=number_works, desc="Subtify")
|
163 |
folder_chunck = "chunks"
|
164 |
folder_concatenated = "concatenated_transcriptions"
|
@@ -597,12 +604,12 @@ def subtify():
|
|
597 |
|
598 |
auxiliar_block2 = gr.Textbox(placeholder="Waiting", label="Auxiliar block 2", elem_id="auxiliar_block2", interactive=False, visible=visible)
|
599 |
with gr.Row():
|
600 |
-
video_donwloaded_progress_info = gr.Textbox(placeholder="Waiting", label="Video
|
601 |
-
video_sliced_progress_info = gr.Textbox(placeholder="Waiting", label="Video
|
602 |
-
video_transcribed_progress_info = gr.Textbox(placeholder="Waiting", label="
|
603 |
-
transcriptions_concatenated_progress_info = gr.Textbox(placeholder="Waiting", label="
|
604 |
-
video_translated_progress_info = gr.Textbox(placeholder="Waiting", label="
|
605 |
-
video_subtitled_progress_info = gr.Textbox(placeholder="Waiting", label="Video
|
606 |
|
607 |
original_audio_path = gr.Textbox(label="Original audio path", elem_id="original_audio_path", visible=visible)
|
608 |
original_video_path = gr.Textbox(label="Original video path", elem_id="original_video_path", visible=visible)
|
|
|
13 |
|
14 |
NUMBER = 100
|
15 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
16 |
+
DEVICE = "cpu"
|
17 |
DOWNLOAD = True
|
18 |
SLICE_AUDIO = True
|
19 |
TRANSCRIBE_AUDIO = True
|
|
|
23 |
REMOVE_FILES = True
|
24 |
if DEVICE == "cpu":
|
25 |
# I supose that I am on huggingface server
|
26 |
+
# Get RAM space
|
27 |
+
ram = int(os.popen("free -m | grep Mem | awk '{print $2}'").read())
|
28 |
+
vram = 12288
|
29 |
+
SECONDS = int(ram*700/vram)
|
30 |
+
print(f"RAM: {ram}")
|
31 |
else:
|
32 |
+
# I supose that I am on my computer
|
33 |
+
# Get VRAM space
|
34 |
SECONDS = 300
|
35 |
|
36 |
YOUTUBE = "youtube"
|
|
|
165 |
language_dict = union_language_dict()
|
166 |
|
167 |
def subtify_no_ui():
|
168 |
+
number_works = 6
|
169 |
progress_bar = tqdm(total=number_works, desc="Subtify")
|
170 |
folder_chunck = "chunks"
|
171 |
folder_concatenated = "concatenated_transcriptions"
|
|
|
604 |
|
605 |
auxiliar_block2 = gr.Textbox(placeholder="Waiting", label="Auxiliar block 2", elem_id="auxiliar_block2", interactive=False, visible=visible)
|
606 |
with gr.Row():
|
607 |
+
video_donwloaded_progress_info = gr.Textbox(placeholder="Waiting", label="Video download progress info", elem_id="video_donwloaded_progress_info", interactive=False, visible=visible)
|
608 |
+
video_sliced_progress_info = gr.Textbox(placeholder="Waiting", label="Video slice progress info", elem_id="video_sliced_progress_info", interactive=False, visible=visible)
|
609 |
+
video_transcribed_progress_info = gr.Textbox(placeholder="Waiting", label="Transcribe progress info", elem_id="video_transcribed_progress_info", interactive=False, visible=visible)
|
610 |
+
transcriptions_concatenated_progress_info = gr.Textbox(placeholder="Waiting", label="Concatenate progress info", elem_id="transcriptions_concatenated_progress_info", interactive=False, visible=visible)
|
611 |
+
video_translated_progress_info = gr.Textbox(placeholder="Waiting", label="Translate progress info", elem_id="transcription_translated_progress_info", interactive=False, visible=visible)
|
612 |
+
video_subtitled_progress_info = gr.Textbox(placeholder="Waiting", label="Video subtitle progress info", elem_id="video_subtitled_progress_info", interactive=False, visible=visible)
|
613 |
|
614 |
original_audio_path = gr.Textbox(label="Original audio path", elem_id="original_audio_path", visible=visible)
|
615 |
original_video_path = gr.Textbox(label="Original video path", elem_id="original_video_path", visible=visible)
|