Hf.space/run/predict Data Aggregate howto?
Hi, I understand the syntaxcurl -X POST -H 'Content-type: application/json' --data '{ "data": ["Jill"] }' https://USER_NAME-SPACE_NAME.hf.space/run/predictand trying it out on a space with a simple text input e.g.,curl -X POST -H 'Content-type: application/json' --data '{ "data": ["Jill"] }' https://tomsoderlund-rest-api-with-gradio.hf.space/run/predictreturns a nice{"data":["Hello Jill!"],"is_generating":false,"duration":0.00015020370483398438,"average_duration":0.00018148869276046753}But how do I post to a space with sliders, toggles, etc?For instance, I triedhttps://huggingface.co/spaces/Svngoku/galactica-basewhose API suggest this Input Payload{
  "data": [
    str | None, // represents sample input to preprocess. of 'Input Text' Textbox component
    Any, // represents null of 'Max Length' Slider component
    Any, // represents null of 'Temperature' Slider component
    Any, // represents null of 'Do Sample' Checkbox component
  ]
}does not work withPOST https://svngoku-galactica-base.hf.space/run/predict
Content-Type: application/json
{ "data": ["Test",128,0.7,True]}and returns{
  "detail": [
    {
      "loc": [
        "body",
        32
      ],
      "msg": "Expecting value: line 2 column 21 (char 32)",
      "type": "value_error.jsondecode",
      "ctx": {
        "msg": "Expecting value",
        "doc": "{ \"data\": [\n  \t  \"Test\",128,0.7,True]}",
        "pos": 32,
        "lineno": 2,
        "colno": 21
      }
    }
  ]
}I tried many variants, key/value pairs, adding parameters beside data, but none worked.So, my question is how to aggregate data correctly for spaces with GUI elements when using /run/predict POST?  Thanks.
2023-02-03T20:35:43Z
hi@cerkut,I tested the request and it works fineOn your browser consolefetch("https://svngoku-galactica-base.hf.space/run/predict", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({ data: ["Test", 128, 0.7, true] }),
})
.then(res=> res.json())
.then(r=> console.log(r))and with curlcurl -X POST https://svngoku-galactica-base.hf.space/run/predict -H 'Content-Type: application/json' -d '{"data":["The attention mechanism in LLM is",128,0.7,true]}'