Using Gradio API Replica URL's / Issue with --replica

When I rebuild a T4 GPU docker my URL keeps changing to indicate the replica. E.g.:
https://awacke1-speech-recognition-canary-nvidiat4.hf.space/--replicas/y35z0/

When I call the gradio app as API I would like to make the consumer impervious to a change in URL.

Will it work if I don’t include replica in the URL. e.g.
https://awacke1-speech-recognition-canary-nvidiat4.hf.space/ ?

My calling code uses the URL as follows:
def transcribeWavtoTxt(filename):
from gradio_client import Client
with open(filename, “rb”) as f:
data = f.read()
url=‘https://awacke1-speech-recognition-canary-nvidiat4.hf.space/--replicas/4j9xb/
client = Client(url)

    #old URL from last build ---      client = Client("https://awacke1-speech-recognition-canary-nvidiat4.hf.space/--replicas/0wdf4/")
    result = client.predict(
            filename,
            "English",	# Literal['English', 'Spanish', 'French', 'German']  in 'Input audio is spoken in:' Dropdown component
            "English",	# Literal['English', 'Spanish', 'French', 'German']  in 'Transcribe in language:' Dropdown component
            True,	# bool  in 'Punctuation & Capitalization in transcript?' Checkbox component
            api_name="/transcribe"
    )
    return result

Hello @awacke1, yes, you’re correct; there’s no need to be concerned with the replica suffix at the end of the URL, as your internal proxy will handle that aspect effectively.

1 Like

You’re the best. Thankyou sir for quick response. Much appreciated!

–Aaron

1 Like