Update app.py
#1
by
Satyam-Singh
- opened
No description provided.
Please Do it for just one month for my project.
Please
Hey @Satyam-Singh , if you first install the gradio lirary:
pip install -U gradio
You should then be able to do the following:
from gradio_client import Client
API_URL = "https://sanchit-gandhi-whisper-jax.hf.space/"
# set up the Gradio client
client = Client(API_URL)
def transcribe_audio(audio_path, task="transcribe", return_timestamps=False):
"""Function to transcribe an audio file using the Whisper JAX endpoint."""
if task not in ["transcribe", "translate"]:
raise ValueError("task should be one of 'transcribe' or 'translate'.")
text, runtime = client.predict(
audio_path,
task,
return_timestamps,
api_name="/predict_1",
)
return text
# transcribe an audio file using the Whisper JAX endpoint
output = transcribe_audio("audio.mp3")
# transcribe and return timestamps
output_with_timestamps = transcribe_audio("audio.mp3", return_timestamps=True)