Sangmin commited on
Commit
cb5005d
1 Parent(s): ac98964

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -35,7 +35,7 @@ def transcribe(inputs, task, return_timestamps):
35
  if inputs is None:
36
  raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
37
 
38
- text = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=return_timestamps)
39
 
40
  if return_timestamps:
41
  return chunks_to_srt(result['chunks'])
@@ -95,8 +95,7 @@ def yt_transcribe(yt_url, task, return_timestamps, max_filesize=75.0):
95
  inputs = ffmpeg_read(inputs, pipe.feature_extractor.sampling_rate)
96
  inputs = {"array": inputs, "sampling_rate": pipe.feature_extractor.sampling_rate}
97
 
98
- text = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=True)
99
- text = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=return_timestamps)
100
 
101
  if return_timestamps:
102
  return html_embed_str, chunks_to_srt(result['chunks'])
 
35
  if inputs is None:
36
  raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
37
 
38
+ result = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=return_timestamps)
39
 
40
  if return_timestamps:
41
  return chunks_to_srt(result['chunks'])
 
95
  inputs = ffmpeg_read(inputs, pipe.feature_extractor.sampling_rate)
96
  inputs = {"array": inputs, "sampling_rate": pipe.feature_extractor.sampling_rate}
97
 
98
+ result = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=return_timestamps)
 
99
 
100
  if return_timestamps:
101
  return html_embed_str, chunks_to_srt(result['chunks'])