Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,12 +33,11 @@ def download_video(url):
|
|
| 33 |
for chunk in response.iter_content(chunk_size=8192):
|
| 34 |
if chunk:
|
| 35 |
file.write(chunk)
|
| 36 |
-
file.close()
|
| 37 |
print("Video downloaded successfully!")
|
| 38 |
return video_file
|
| 39 |
|
| 40 |
def word_level_transcribe(audio, max_segment_duration=2.0): # Set your desired max duration here
|
| 41 |
-
model = WhisperModel("small", device="cpu")
|
| 42 |
segments, info = model.transcribe(audio, vad_filter=True, vad_parameters=dict(min_silence_duration_ms=1500), word_timestamps=True, log_progress=True)
|
| 43 |
segments = list(segments) # The transcription will actually run here.
|
| 44 |
wordlevel_info = []
|
|
|
|
| 33 |
for chunk in response.iter_content(chunk_size=8192):
|
| 34 |
if chunk:
|
| 35 |
file.write(chunk)
|
|
|
|
| 36 |
print("Video downloaded successfully!")
|
| 37 |
return video_file
|
| 38 |
|
| 39 |
def word_level_transcribe(audio, max_segment_duration=2.0): # Set your desired max duration here
|
| 40 |
+
model = WhisperModel("small", device="cpu", local_files_only=True)
|
| 41 |
segments, info = model.transcribe(audio, vad_filter=True, vad_parameters=dict(min_silence_duration_ms=1500), word_timestamps=True, log_progress=True)
|
| 42 |
segments = list(segments) # The transcription will actually run here.
|
| 43 |
wordlevel_info = []
|