ayaanzaveri commited on
Commit
f115402
1 Parent(s): a9f9972
Files changed (1) hide show
  1. main.py +4 -5
main.py CHANGED
@@ -16,12 +16,9 @@ app.add_middleware(
16
  allow_headers=["*"],
17
  )
18
 
19
- model_size = "tiny"
20
-
21
  # or run on GPU with INT8
22
  # model = WhisperModel(model_size, device="cuda", compute_type="int8_float16")
23
  # or run on CPU with INT8
24
- model = WhisperModel(model_size, device="cpu", compute_type="int8")
25
 
26
  def segment_to_dict(segment):
27
  segment = segment._asdict()
@@ -34,8 +31,10 @@ 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, 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}")
 
16
  allow_headers=["*"],
17
  )
18
 
 
 
19
  # or run on GPU with INT8
20
  # model = WhisperModel(model_size, device="cuda", compute_type="int8_float16")
21
  # or run on CPU with INT8
 
22
 
23
  def segment_to_dict(segment):
24
  segment = segment._asdict()
 
31
  download_convert_video_to_audio(yt_dlp, video_url, f"/home/user/{uuid.uuid4().hex}")
32
 
33
  @app.post("/transcribe")
34
+ async def transcribe_video(video_url: str, beam_size: int = 5, model_size: str = "tiny", word_timestamps: bool = True):
35
+ print("loading model")
36
+ model = WhisperModel(model_size, device="cpu", compute_type="int8")
37
+ print("getting hex")
38
  rand_id = uuid.uuid4().hex
39
  print("doing download")
40
  download_convert_video_to_audio(yt_dlp, video_url, f"/home/user/{rand_id}")