R
Runpod11mo ago
octopus

Huggingface space on Serverless. How to get the Gradio API string which is the same as Worker ID?

I deployed Huggingface Space which use Gradio. If I have worker ID then I can connect to the worker usually like https://${workerID}-proxy.runpod.net/ How can I either the available workerIDs or forward my request from serverless endpoint to Gradio API which uses something like:
import { Client } from "@gradio/client";

const response_0 = await fetch("https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png");
const exampleImage = await response_0.blob();

const client = await Client.connect("https://${workerID}-7860.proxy.runpod.net/");
const result = await client.predict("/stream_chat", {
input_image: exampleImage,
});

console.log(result.data);
import { Client } from "@gradio/client";

const response_0 = await fetch("https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png");
const exampleImage = await response_0.blob();

const client = await Client.connect("https://${workerID}-7860.proxy.runpod.net/");
const result = await client.predict("/stream_chat", {
input_image: exampleImage,
});

console.log(result.data);
3 Replies
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
niroknox
niroknox10mo ago
When you queue the job, you can get the workerID checking the queued request, and perhaps 'push' it somewhere like a txt file or even serve it via rest api and the worker can fetch it. also worth checking the environment it might be there?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?