|
17 | 17 | from secrets import compare_digest
|
18 | 18 |
|
19 | 19 | import modules.shared as shared
|
20 |
| -from modules import sd_samplers, deepbooru, sd_hijack, images, scripts, ui, postprocessing, errors, restart, shared_items, script_callbacks, infotext_utils, sd_models |
| 20 | +from modules import sd_samplers, deepbooru, sd_hijack, images, scripts, ui, postprocessing, errors, restart, shared_items, script_callbacks, infotext_utils, sd_models, sd_schedulers |
21 | 21 | from modules.api import models
|
22 | 22 | from modules.shared import opts
|
23 | 23 | from modules.processing import StableDiffusionProcessingTxt2Img, StableDiffusionProcessingImg2Img, process_images
|
@@ -221,6 +221,7 @@ def __init__(self, app: FastAPI, queue_lock: Lock):
|
221 | 221 | self.add_api_route("/sdapi/v1/options", self.set_config, methods=["POST"])
|
222 | 222 | self.add_api_route("/sdapi/v1/cmd-flags", self.get_cmd_flags, methods=["GET"], response_model=models.FlagsModel)
|
223 | 223 | self.add_api_route("/sdapi/v1/samplers", self.get_samplers, methods=["GET"], response_model=list[models.SamplerItem])
|
| 224 | + self.add_api_route("/sdapi/v1/schedulers", self.get_schedulers, methods=["GET"], response_model=list[models.SchedulerItem]) |
224 | 225 | self.add_api_route("/sdapi/v1/upscalers", self.get_upscalers, methods=["GET"], response_model=list[models.UpscalerItem])
|
225 | 226 | self.add_api_route("/sdapi/v1/latent-upscale-modes", self.get_latent_upscale_modes, methods=["GET"], response_model=list[models.LatentUpscalerModeItem])
|
226 | 227 | self.add_api_route("/sdapi/v1/sd-models", self.get_sd_models, methods=["GET"], response_model=list[models.SDModelItem])
|
@@ -683,6 +684,17 @@ def get_cmd_flags(self):
|
683 | 684 | def get_samplers(self):
|
684 | 685 | return [{"name": sampler[0], "aliases":sampler[2], "options":sampler[3]} for sampler in sd_samplers.all_samplers]
|
685 | 686 |
|
| 687 | + def get_schedulers(self): |
| 688 | + return [ |
| 689 | + { |
| 690 | + "name": scheduler.name, |
| 691 | + "label": scheduler.label, |
| 692 | + "aliases": scheduler.aliases, |
| 693 | + "default_rho": scheduler.default_rho, |
| 694 | + "need_inner_model": scheduler.need_inner_model, |
| 695 | + } |
| 696 | + for scheduler in sd_schedulers.schedulers] |
| 697 | + |
686 | 698 | def get_upscalers(self):
|
687 | 699 | return [
|
688 | 700 | {
|
|
0 commit comments