# How can i add "scheduler" in diffuser (inference api)?

**URL:** <https://discuss.huggingface.co/t/how-can-i-add-scheduler-in-diffuser-inference-api/54353>\
**Category:** 🧨 Diffusers\
**Created:** [September 10, 2023, 10:48pm UTC](https://discuss.huggingface.co/t/how-can-i-add-scheduler-in-diffuser-inference-api/54353 "2023-09-10T22:48:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DamarJati](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/damarjati/32/30406_2.png) [@DamarJati](https://discuss.huggingface.co/u/DamarJati)\
**Post date:** [September 10, 2023, 10:48pm UTC](https://discuss.huggingface.co/t/how-can-i-add-scheduler-in-diffuser-inference-api/54353/1 "2023-09-10T22:48:52Z")

</div>

how can i add “scheduler” in diffuser??  
[EulerAncestralDiscreteScheduler](https://huggingface.co/docs/diffusers/v0.20.0/en/api/schedulers/euler_ancestral#diffusers.EulerAncestralDiscreteScheduler)

```auto
import requests
from PIL import Image
import io

API_URL = "https://api-inference.huggingface.co/models/DamarJati/melaura-v1.2"
headers = {"Authorization": "Bearer hf_CfvxxxxxxyYfJRxxxxOwmxxx"}

def query(payload):
    response = requests.post(API_URL, headers=headers, json=payload)
    if response.status_code == 200:
        return response.content
    else:
        print("API request failed with status code:", response.status_code)
        return None

image_bytes = query({
    "inputs": "melaura, girl, hd, pink lips, detailed, age 16, Off-shoulder top, shiny cheeks, ",
    "negative_prompt": "earrings, deformed, blurry, badanatomy, bad proportions, "
})

if image_bytes is not None:
    try:
        image = Image.open(io.BytesIO(image_bytes))
        # Save the image to a file
        image.save("output_image.png")
        image.show() # Displays images
    except Exception as e:
        print("Error while opening or displaying the image:", str(e))
else:
    print("Failed to get image from the API.")

```
