# Hf.space/run/predict Data Aggregate howto?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhf-space-run-predict-data-aggregate-howto%2F30665%3E%5C
**Category:** Spaces\
**Created:** [January 29, 2023, 5:39am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhf-space-run-predict-data-aggregate-howto%2F30665 "2023-01-29T05:39:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cerkut](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/cerkut/32/3679_2.png) [@cerkut](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fcerkut)%5C
**Post date:** [January 29, 2023, 5:39am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhf-space-run-predict-data-aggregate-howto%2F30665%2F1 "2023-01-29T05:39:33Z")

</div>

Hi, I understand the syntax `curl -X POST -H 'Content-type: application/json' --data '{ "data": ["Jill"] }' https://USER_NAME-SPACE_NAME.hf.space/run/predict`  
and trying it out on a space with a simple text input e.g.,

```auto
curl -X POST -H 'Content-type: application/json' --data '{ "data": ["Jill"] }' https://tomsoderlund-rest-api-with-gradio.hf.space/run/predict

```

returns a nice

```auto
{"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 tried [https://huggingface.co/spaces/Svngoku/galactica-base](https://huggingface.co/spaces/Svngoku/galactica-base)  
whose API suggest this Input Payload

```auto
{
  "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 with

```auto
POST https://svngoku-galactica-base.hf.space/run/predict
Content-Type: application/json
{ "data": ["Test",128,0.7,True]}

```

and returns

```auto
{
  "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.

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fradames)%5C
**Post date:** [February 3, 2023, 8:35pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhf-space-run-predict-data-aggregate-howto%2F30665%2F2 "2023-02-03T20:35:43Z")

</div>

hi @cerkut ,

I tested the request and it works fine

On your browser console

```plaintext
fetch("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 curl

```auto
curl -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]}'

```
