ayaanzaveri commited on
Commit
a9f9972
1 Parent(s): da90409

timestamps

Browse files
Files changed (1) hide show
  1. main.py +2 -2
main.py CHANGED
@@ -34,12 +34,12 @@ async def download_video(video_url: str):
34
  download_convert_video_to_audio(yt_dlp, video_url, f"/home/user/{uuid.uuid4().hex}")
35
 
36
  @app.post("/transcribe")
37
- async def transcribe_video(video_url: str, beam_size: int = 5):
38
  print("doing hex")
39
  rand_id = uuid.uuid4().hex
40
  print("doing download")
41
  download_convert_video_to_audio(yt_dlp, video_url, f"/home/user/{rand_id}")
42
- segments, info = model.transcribe(f"/home/user/{rand_id}.mp3", beam_size=beam_size, word_timestamps=True)
43
  segments = [segment_to_dict(segment) for segment in segments]
44
  total_duration = round(info.duration, 2) # Same precision as the Whisper timestamps.
45
  print(info)
 
34
  download_convert_video_to_audio(yt_dlp, video_url, f"/home/user/{uuid.uuid4().hex}")
35
 
36
  @app.post("/transcribe")
37
+ async def transcribe_video(video_url: str, beam_size: int = 5, word_timestamps: bool = True):
38
  print("doing hex")
39
  rand_id = uuid.uuid4().hex
40
  print("doing download")
41
  download_convert_video_to_audio(yt_dlp, video_url, f"/home/user/{rand_id}")
42
+ segments, info = model.transcribe(f"/home/user/{rand_id}.mp3", beam_size=beam_size, word_timestamps=word_timestamps)
43
  segments = [segment_to_dict(segment) for segment in segments]
44
  total_duration = round(info.duration, 2) # Same precision as the Whisper timestamps.
45
  print(info)