Update handler.py

#1
by davidberenstein1957 HF staff - opened
Data Is Better Together org

the following input is send to the endpoint with a post request.

{'json': {'inputs': 'a dog waiting for its companion to come.', 'parameters': {'negative_prompt': 'no dog', 'height': 512, 'width': 512, 'num_inference_steps': 25, 'guidance_scale': 7.5}}}
Data Is Better Together org

I am not sure why we need these changes. Can you explain?

Data Is Better Together org

@sayakpaul distilabel uses the https://huggingface.co/docs/huggingface_hub/en/package_reference/inference_client#huggingface_hub.InferenceClient.text_to_image method internally. This method formats the json request according to the following method: https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/inference/_common.py#L262. This method wraps add the "prompt" argument as an "input" key, and each additional parameter as a separate key in a dict which under a "parameters" key.

davidberenstein1957 changed pull request status to merged

Sign up or log in to comment