Spaces:
Runtime error
Runtime error
Commit
·
41479fc
1
Parent(s):
6faf1b6
Cleanup commented code
Browse files- models/whisper.py +1 -36
models/whisper.py
CHANGED
@@ -20,39 +20,4 @@ def get_prediction_with_timelines(pipe, sample):
|
|
20 |
return pipe(sample, batch_size=8, return_timestamps=True)["chunks"]
|
21 |
|
22 |
def get_prediction(pipe, sample):
|
23 |
-
return pipe(sample, batch_size=8)["text"]
|
24 |
-
|
25 |
-
|
26 |
-
# audio_file = open("movie.mp3", "rb")
|
27 |
-
# sample = audio_file.read()
|
28 |
-
# prediction = pipe(sample, batch_size=8, return_timestamps=True)["chunks"]
|
29 |
-
|
30 |
-
|
31 |
-
# def main():
|
32 |
-
# print("# Extracting audio from video")
|
33 |
-
# # audio = get_audio_from_video("movie.mp4", "movie.mp3")
|
34 |
-
# print("# Splitting audio into chunks")
|
35 |
-
# split_audio("movie.mp3", "movie_parts", 30)
|
36 |
-
# print("# Gettin Device")
|
37 |
-
# device = get_device()
|
38 |
-
# print("# Getting Pipeline")
|
39 |
-
# pipe = get_pipe(device)
|
40 |
-
# print("# Getting Predictions")
|
41 |
-
# for file in os.listdir("movie_parts"):
|
42 |
-
# print(f"Processing {file}")
|
43 |
-
# audio_file = open(os.path.join("movie_parts", file), "rb")
|
44 |
-
# sample = audio_file.read()
|
45 |
-
# print(f"# Getting Prediction for file {file}")
|
46 |
-
# prediction = get_prediction(pipe, sample)
|
47 |
-
# print(f"# Saving Subtitles for file {file}")
|
48 |
-
# save_subtitles(prediction, file.replace(".mp3", ".srt"))
|
49 |
-
# # Aggregating subtitles into one file
|
50 |
-
# print("# Aggregating subtitles into one file")
|
51 |
-
# with open("movie.srt", "w") as f:
|
52 |
-
# for file in os.listdir("movie_parts"):
|
53 |
-
# with open(os.path.join("movie_parts", file), "r") as f2:
|
54 |
-
# f.write(f2.read())
|
55 |
-
# print("# Done")
|
56 |
-
|
57 |
-
# if __name__ == "__main__":
|
58 |
-
# main()
|
|
|
20 |
return pipe(sample, batch_size=8, return_timestamps=True)["chunks"]
|
21 |
|
22 |
def get_prediction(pipe, sample):
|
23 |
+
return pipe(sample, batch_size=8)["text"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|