Spaces:
Sleeping
Sleeping
Commit
•
9e9ee40
1
Parent(s):
bab39d8
Update app.py
Browse files
app.py
CHANGED
@@ -334,11 +334,26 @@ def change_speed(audio_inp, speed=1.0):
|
|
334 |
slower_audio.export("slower_speech.wav", format="wav")
|
335 |
return "slower_speech.wav"
|
336 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
|
338 |
def convert_from_srt(api_key, filename, audio_full, voice, multilingual):
|
339 |
|
340 |
subtitle_list = read_srt(filename)
|
341 |
-
|
|
|
342 |
#audio_data, sr = librosa.load(audio_full, sr=44100)
|
343 |
|
344 |
#write("audio_full.wav", sr, audio_data.astype(np.int16))
|
|
|
334 |
slower_audio.export("slower_speech.wav", format="wav")
|
335 |
return "slower_speech.wav"
|
336 |
|
337 |
+
# delete files first
|
338 |
+
|
339 |
+
def delete_sliced_files(directory):
|
340 |
+
# Iterate over all files in the directory
|
341 |
+
for foldername, subfolders, filenames in os.walk(directory):
|
342 |
+
for filename in filenames:
|
343 |
+
# Check if the file starts with "sliced"
|
344 |
+
if filename.startswith("sliced"):
|
345 |
+
# Create the complete file path
|
346 |
+
file_path = os.path.join(foldername, filename)
|
347 |
+
# Delete the file
|
348 |
+
os.remove(file_path)
|
349 |
+
print(f"Deleted {filename}")
|
350 |
+
|
351 |
|
352 |
def convert_from_srt(api_key, filename, audio_full, voice, multilingual):
|
353 |
|
354 |
subtitle_list = read_srt(filename)
|
355 |
+
delete_sliced_files("./")
|
356 |
+
|
357 |
#audio_data, sr = librosa.load(audio_full, sr=44100)
|
358 |
|
359 |
#write("audio_full.wav", sr, audio_data.astype(np.int16))
|