reab5555 commited on
Commit
e3225d2
·
verified ·
1 Parent(s): 393cd8d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -24,14 +24,16 @@ def transcribe(audio_file, transcribe_to_text, transcribe_to_srt, language):
24
  feature_extractor=processor.feature_extractor,
25
  max_new_tokens=128,
26
  chunk_length_s=30,
27
- batch_size=1,
28
  return_timestamps=True,
29
  torch_dtype=torch_dtype,
30
  device=device,
31
  generate_kwargs={"language": language}
32
  )
33
 
34
- audio = AudioFileClip(audio_file.name)
 
 
35
  duration = audio.duration
36
  n_chunks = math.ceil(duration / 30)
37
 
 
24
  feature_extractor=processor.feature_extractor,
25
  max_new_tokens=128,
26
  chunk_length_s=30,
27
+ batch_size=2,
28
  return_timestamps=True,
29
  torch_dtype=torch_dtype,
30
  device=device,
31
  generate_kwargs={"language": language}
32
  )
33
 
34
+ # Handle both file path (str) and file object
35
+ audio_path = audio_file if isinstance(audio_file, str) else audio_file.name
36
+ audio = AudioFileClip(audio_path)
37
  duration = audio.duration
38
  n_chunks = math.ceil(duration / 30)
39