Hugging face space api integration

I am using wix chatbot and I need to integrate my public space API in the chat, but I am struck in creating the request payload to my API.

I am not sure how to build a request pay load for the API.

By using the iframe code, and ran the space with html file and analyzed it with network tab and got below.

Request URL:
https://MyHugging Face space name.hf.space/gradio_api/run/predict
Request Method:
POST
Status Code:
200 OK
Remote Address:
50.17.216.56:443
Referrer Policy:
strict-origin-when-cross-origin

And the request payload in the network tab was,
{data: [“hi”, ], event_data: null, fn_index: 0, trigger_id: 8, session_hash: “ntwomc7trv”}
data: [“hi”, ]
event_data: null
fn_index: 0
session_hash: “ntwomc7trv”
trigger_id: 8

Here, “hi” is the only word that i gave as input through the iframe UI, rest all attributes were automatically generated by the gradio. Now I am not sure how to fill these attributes when I am using this in my js script. is there any other format for this?

1 Like

Click on “Use via API” at the bottom of each space for more information.

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.