Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,12 +37,12 @@ def transcribe(microphone, file_upload, task):
|
|
| 37 |
|
| 38 |
pipe.model.config.forced_decoder_ids = [[2, transcribe_token_id if task=="transcribe" else translate_token_id]]
|
| 39 |
|
| 40 |
-
|
| 41 |
|
| 42 |
with open('outt.txt', 'a+') as sw:
|
| 43 |
-
sw.writelines(
|
| 44 |
|
| 45 |
-
return [
|
| 46 |
|
| 47 |
|
| 48 |
def _return_yt_html_embed(yt_url):
|
|
@@ -68,7 +68,7 @@ def yt_transcribe(yt_url, task):
|
|
| 68 |
|
| 69 |
|
| 70 |
demo = gr.Blocks()
|
| 71 |
-
|
| 72 |
mf_transcribe = gr.Interface(
|
| 73 |
fn=transcribe,
|
| 74 |
inputs=[
|
|
@@ -76,7 +76,7 @@ mf_transcribe = gr.Interface(
|
|
| 76 |
gr.inputs.Audio(source="upload", type="filepath", optional=True),
|
| 77 |
gr.inputs.Radio(["transcribe", "translate"], label="Task", default="transcribe"),
|
| 78 |
],
|
| 79 |
-
outputs=["text",
|
| 80 |
layout="horizontal",
|
| 81 |
theme="huggingface",
|
| 82 |
title="Whisper Large V2: Transcribe Audio",
|
|
|
|
| 37 |
|
| 38 |
pipe.model.config.forced_decoder_ids = [[2, transcribe_token_id if task=="transcribe" else translate_token_id]]
|
| 39 |
|
| 40 |
+
textt = pipe(file, batch_size=BATCH_SIZE)["text"]
|
| 41 |
|
| 42 |
with open('outt.txt', 'a+') as sw:
|
| 43 |
+
sw.writelines(textt)
|
| 44 |
|
| 45 |
+
return [textt,"outt.txt"]
|
| 46 |
|
| 47 |
|
| 48 |
def _return_yt_html_embed(yt_url):
|
|
|
|
| 68 |
|
| 69 |
|
| 70 |
demo = gr.Blocks()
|
| 71 |
+
output_2 = gr.File(label="Download")
|
| 72 |
mf_transcribe = gr.Interface(
|
| 73 |
fn=transcribe,
|
| 74 |
inputs=[
|
|
|
|
| 76 |
gr.inputs.Audio(source="upload", type="filepath", optional=True),
|
| 77 |
gr.inputs.Radio(["transcribe", "translate"], label="Task", default="transcribe"),
|
| 78 |
],
|
| 79 |
+
outputs=["text",output_2],
|
| 80 |
layout="horizontal",
|
| 81 |
theme="huggingface",
|
| 82 |
title="Whisper Large V2: Transcribe Audio",
|