From df08f44a9bb7b126930ef4fec8917be5ed4aae36 Mon Sep 17 00:00:00 2001 From: zuencap <37028435+zuencap@users.noreply.github.com> Date: Wed, 22 Mar 2023 20:56:32 +0100 Subject: [PATCH] Make api.py python 3.9 compatible Colab uses python 3.9 --- scripts/api.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/scripts/api.py b/scripts/api.py index 0837c23..1660a1e 100644 --- a/scripts/api.py +++ b/scripts/api.py @@ -35,19 +35,13 @@ async def return_model_unet_channel_count( } def switchAssumption(channelCount): - match channelCount: - case 4: - return "traditional" - case 5: - return "sdv2 depth2img" - case 7: - return "sdv2 upscale 4x" - case 8: - return "instruct-pix2pix" - case 9: - return "inpainting" - case _: - return "¯\_(ツ)_/¯" + return { + 4: "traditional", + 5: "sdv2 depth2img", + 7: "sdv2 upscale 4x", + 8: "instruct-pix2pix", + 9: "inpainting" + }.get(channelCount, "¯\_(ツ)_/¯") def get_current_model(): options = {} @@ -67,4 +61,4 @@ def get_current_model(): except: print("[openOutpaint-webui-extension] UNET API failed to initialize") - \ No newline at end of file +