fixed wav split bug
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ def download_video(url):
|
|
17 |
video_clip.close()
|
18 |
for removalmp4 in glob.glob("*.mp4"):
|
19 |
os.remove(removalmp4)
|
20 |
-
return "Finished downloading! Please proceed to
|
21 |
|
22 |
def split_audio_from_yt_video(mindur, maxdur, name_for_split_files, show_amount_of_files_and_file_dur):
|
23 |
if show_amount_of_files_and_file_dur == True:
|
@@ -122,6 +122,8 @@ def split_wav_file(audiofileuploader, mindur2, maxdur2, name_for_split_files2):
|
|
122 |
with zipfile.ZipFile(zip_file_name2, "w") as zip_file:
|
123 |
for audio_file in audio_files:
|
124 |
zip_file.write(audio_file, os.path.basename(audio_file))
|
|
|
|
|
125 |
return f"File split successfully!\nCheck below for zipped files.\nAmount created: {len(audio_files)}", zip_file_name2
|
126 |
|
127 |
with gr.Blocks(theme=gr.themes.Monochrome(), title="Global Dataset Maker") as app:
|
@@ -151,6 +153,7 @@ with gr.Blocks(theme=gr.themes.Monochrome(), title="Global Dataset Maker") as ap
|
|
151 |
maxdur = gr.Number(label="Max duration", minimum=1, maximum=10, value=5)
|
152 |
name_for_split_files = gr.Textbox(label="Name for split files")
|
153 |
show_amount_of_files_and_file_dur = gr.Checkbox(False, label="Show total amount of files and duration?")
|
|
|
154 |
splitbtn = gr.Button("Split", variant='primary')
|
155 |
splitbtn.click(
|
156 |
split_audio_from_yt_video,
|
@@ -170,10 +173,10 @@ with gr.Blocks(theme=gr.themes.Monochrome(), title="Global Dataset Maker") as ap
|
|
170 |
[zipuploader],
|
171 |
[gr.Text(label="Result")]
|
172 |
)
|
173 |
-
with gr.Tab("File splitter
|
174 |
gr.Markdown("If you would rather split a single WAV (mp3 support soon) audio file, use this method instead.")
|
175 |
gr.HTML(
|
176 |
-
"<h1>
|
177 |
)
|
178 |
with gr.Row():
|
179 |
with gr.Column():
|
|
|
17 |
video_clip.close()
|
18 |
for removalmp4 in glob.glob("*.mp4"):
|
19 |
os.remove(removalmp4)
|
20 |
+
return "Finished downloading! Please proceed to next tab."
|
21 |
|
22 |
def split_audio_from_yt_video(mindur, maxdur, name_for_split_files, show_amount_of_files_and_file_dur):
|
23 |
if show_amount_of_files_and_file_dur == True:
|
|
|
122 |
with zipfile.ZipFile(zip_file_name2, "w") as zip_file:
|
123 |
for audio_file in audio_files:
|
124 |
zip_file.write(audio_file, os.path.basename(audio_file))
|
125 |
+
for file2 in glob.glob("*.wav"):
|
126 |
+
os.remove(file2)
|
127 |
return f"File split successfully!\nCheck below for zipped files.\nAmount created: {len(audio_files)}", zip_file_name2
|
128 |
|
129 |
with gr.Blocks(theme=gr.themes.Monochrome(), title="Global Dataset Maker") as app:
|
|
|
153 |
maxdur = gr.Number(label="Max duration", minimum=1, maximum=10, value=5)
|
154 |
name_for_split_files = gr.Textbox(label="Name for split files")
|
155 |
show_amount_of_files_and_file_dur = gr.Checkbox(False, label="Show total amount of files and duration?")
|
156 |
+
keep_original_wav_file = gr.Checkbox(False, label="Keep wav file?")
|
157 |
splitbtn = gr.Button("Split", variant='primary')
|
158 |
splitbtn.click(
|
159 |
split_audio_from_yt_video,
|
|
|
173 |
[zipuploader],
|
174 |
[gr.Text(label="Result")]
|
175 |
)
|
176 |
+
with gr.Tab("File splitter"):
|
177 |
gr.Markdown("If you would rather split a single WAV (mp3 support soon) audio file, use this method instead.")
|
178 |
gr.HTML(
|
179 |
+
"<h1> Most bugs should be fixed now, if not, let me know. </h1>"
|
180 |
)
|
181 |
with gr.Row():
|
182 |
with gr.Column():
|