LucasMendes commited on
Commit
4eaf52e
1 Parent(s): 44c16da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -1,4 +1,6 @@
1
  import torch
 
 
2
 
3
  import gradio as gr
4
  import yt_dlp as youtube_dl
@@ -27,7 +29,7 @@ def transcribe(inputs, task):
27
  if inputs is None:
28
  raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
29
 
30
- text = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=True)
31
  return text
32
 
33
 
@@ -83,7 +85,7 @@ def yt_transcribe(yt_url, task, max_filesize=75.0):
83
  inputs = ffmpeg_read(inputs, pipe.feature_extractor.sampling_rate)
84
  inputs = {"array": inputs, "sampling_rate": pipe.feature_extractor.sampling_rate}
85
 
86
- text = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=True)["text"]
87
 
88
  return html_embed_str, text
89
 
 
1
  import torch
2
+ import json
3
+
4
 
5
  import gradio as gr
6
  import yt_dlp as youtube_dl
 
29
  if inputs is None:
30
  raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
31
 
32
+ text = json.dumps(pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=True))
33
  return text
34
 
35
 
 
85
  inputs = ffmpeg_read(inputs, pipe.feature_extractor.sampling_rate)
86
  inputs = {"array": inputs, "sampling_rate": pipe.feature_extractor.sampling_rate}
87
 
88
+ text = json.dumps(pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task}, return_timestamps=True))
89
 
90
  return html_embed_str, text
91