Reasat commited on
Commit
8ca2d7e
·
verified ·
1 Parent(s): 6f4bcce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -27,7 +27,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=False)["text"]
31
  return text
32
 
33
 
@@ -83,7 +83,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=False)["text"]
87
 
88
  return html_embed_str, text
89
 
@@ -94,7 +94,7 @@ mf_transcribe = gr.Interface(
94
  fn=transcribe,
95
  inputs=[
96
  gr.inputs.Audio(source="microphone", type="filepath", optional=True),
97
- gr.inputs.Radio(["transcribe", "translate"], label="Task", default="transcribe"),
98
  ],
99
  outputs="text",
100
  layout="horizontal",
@@ -112,7 +112,7 @@ file_transcribe = gr.Interface(
112
  fn=transcribe,
113
  inputs=[
114
  gr.inputs.Audio(source="upload", type="filepath", optional=True, label="Audio file"),
115
- gr.inputs.Radio(["transcribe", "translate"], label="Task", default="transcribe"),
116
  ],
117
  outputs="text",
118
  layout="horizontal",
@@ -130,7 +130,7 @@ yt_transcribe = gr.Interface(
130
  fn=yt_transcribe,
131
  inputs=[
132
  gr.inputs.Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL"),
133
- gr.inputs.Radio(["transcribe", "translate"], label="Task", default="transcribe")
134
  ],
135
  outputs=["html", "text"],
136
  layout="horizontal",
 
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)["text"]
31
  return text
32
 
33
 
 
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)["text"]
87
 
88
  return html_embed_str, text
89
 
 
94
  fn=transcribe,
95
  inputs=[
96
  gr.inputs.Audio(source="microphone", type="filepath", optional=True),
97
+ gr.inputs.Radio(["transcribe"], label="Task", default="transcribe"),
98
  ],
99
  outputs="text",
100
  layout="horizontal",
 
112
  fn=transcribe,
113
  inputs=[
114
  gr.inputs.Audio(source="upload", type="filepath", optional=True, label="Audio file"),
115
+ gr.inputs.Radio(["transcribe"], label="Task", default="transcribe"),
116
  ],
117
  outputs="text",
118
  layout="horizontal",
 
130
  fn=yt_transcribe,
131
  inputs=[
132
  gr.inputs.Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL"),
133
+ gr.inputs.Radio(["transcribe"], label="Task", default="transcribe")
134
  ],
135
  outputs=["html", "text"],
136
  layout="horizontal",