Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -176,7 +176,7 @@ from transformers.pipelines.audio_utils import ffmpeg_read
|
|
176 |
import tempfile
|
177 |
import os
|
178 |
|
179 |
-
MODEL_NAME = "razhan/whisper-base-hawrami"
|
180 |
BATCH_SIZE = 1
|
181 |
FILE_LIMIT_MB = 10
|
182 |
YT_LENGTH_LIMIT_S = 60 * 10 # limit to 1 hour YouTube files
|
@@ -192,7 +192,7 @@ pipe = pipeline(
|
|
192 |
|
193 |
|
194 |
# @spaces.GPU
|
195 |
-
def transcribe(inputs, task="
|
196 |
if inputs is None:
|
197 |
raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
|
198 |
|
@@ -261,7 +261,7 @@ def _return_yt_html_embed(yt_url):
|
|
261 |
# return html_embed_str, text
|
262 |
|
263 |
|
264 |
-
def yt_transcribe(yt_url, task="
|
265 |
progress(0, desc="Loading audio file...")
|
266 |
html_embed_str = _return_yt_html_embed(yt_url)
|
267 |
try:
|
@@ -298,7 +298,7 @@ mf_transcribe = gr.Interface(
|
|
298 |
# gr.Radio(["transcribe", "translate"], label="Task", value="transcribe"),
|
299 |
],
|
300 |
outputs="text",
|
301 |
-
title="Whisper
|
302 |
description=(
|
303 |
"Transcribe long-form microphone or audio inputs with the click of a button! Demo uses the"
|
304 |
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
|
@@ -314,7 +314,7 @@ file_transcribe = gr.Interface(
|
|
314 |
# gr.Radio(["transcribe", "translate"], label="Task", value="transcribe"),
|
315 |
],
|
316 |
outputs="text",
|
317 |
-
title="Whisper
|
318 |
description=(
|
319 |
"Transcribe long-form microphone or audio inputs with the click of a button! Demo uses the"
|
320 |
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
|
@@ -330,7 +330,7 @@ yt_transcribe = gr.Interface(
|
|
330 |
# gr.Radio(["transcribe", "translate"], label="Task", value="transcribe")
|
331 |
],
|
332 |
outputs=["html", "text"],
|
333 |
-
title="Whisper
|
334 |
description=(
|
335 |
"Transcribe long-form YouTube videos with the click of a button! Demo uses the checkpoint"
|
336 |
f" [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe video files of"
|
|
|
176 |
import tempfile
|
177 |
import os
|
178 |
|
179 |
+
MODEL_NAME = "razhan/whisper-base-hawrami-transcription"
|
180 |
BATCH_SIZE = 1
|
181 |
FILE_LIMIT_MB = 10
|
182 |
YT_LENGTH_LIMIT_S = 60 * 10 # limit to 1 hour YouTube files
|
|
|
192 |
|
193 |
|
194 |
# @spaces.GPU
|
195 |
+
def transcribe(inputs, task="transcribe"):
|
196 |
if inputs is None:
|
197 |
raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
|
198 |
|
|
|
261 |
# return html_embed_str, text
|
262 |
|
263 |
|
264 |
+
def yt_transcribe(yt_url, task="transcribe", progress=gr.Progress(), max_filesize=75.0):
|
265 |
progress(0, desc="Loading audio file...")
|
266 |
html_embed_str = _return_yt_html_embed(yt_url)
|
267 |
try:
|
|
|
298 |
# gr.Radio(["transcribe", "translate"], label="Task", value="transcribe"),
|
299 |
],
|
300 |
outputs="text",
|
301 |
+
title="Whisper Horami Demo: Transcribe Audio",
|
302 |
description=(
|
303 |
"Transcribe long-form microphone or audio inputs with the click of a button! Demo uses the"
|
304 |
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
|
|
|
314 |
# gr.Radio(["transcribe", "translate"], label="Task", value="transcribe"),
|
315 |
],
|
316 |
outputs="text",
|
317 |
+
title="Whisper Horami Demo: Transcribe Audio",
|
318 |
description=(
|
319 |
"Transcribe long-form microphone or audio inputs with the click of a button! Demo uses the"
|
320 |
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
|
|
|
330 |
# gr.Radio(["transcribe", "translate"], label="Task", value="transcribe")
|
331 |
],
|
332 |
outputs=["html", "text"],
|
333 |
+
title="Whisper Horami Demo: Translate YouTube",
|
334 |
description=(
|
335 |
"Transcribe long-form YouTube videos with the click of a button! Demo uses the checkpoint"
|
336 |
f" [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe video files of"
|