File size: 530 Bytes
d5c679f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from gradio_client import Client, handle_file
from loguru import logger

from rate_limit import rate_limit_bypass


def get_whisper_hf_client() -> Client:
    API_URL = "sanchit-gandhi/whisper-jax-spaces"
    return Client(API_URL)


@rate_limit_bypass(sleep_time=2)
def hf_transcript(client: Client, audio_path: str):
    text, runtime = client.predict(
        inputs=handle_file(audio_path),
        task="transcribe",
        return_timestamps=False,
        api_name="/predict_1",
    )
    logger.info(text)
    return text