From b10685cc0685cb47f4c46752cd50532fe0472022 Mon Sep 17 00:00:00 2001 From: 0xMRTT <0xMRTT@proton.me> Date: Thu, 8 Jun 2023 20:25:28 +0200 Subject: [PATCH] fix: service --- matrixai.service | 8 ++++++-- matrixai/__init__.py | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/matrixai.service b/matrixai.service index 69ec63f..77bcef9 100644 --- a/matrixai.service +++ b/matrixai.service @@ -1,7 +1,11 @@ [Unit] Description=Matrix AI -After=multi-user.target[Service] +After=multi-user.target + +[Service] Type=simple Restart=always -ExecStart=/usr/bin/python3 /home/0xmrtt/matrixai/run.sh +ExecStart=/home/0xmrtt/matrixai/run.sh + +[Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/matrixai/__init__.py b/matrixai/__init__.py index 6314827..e139408 100644 --- a/matrixai/__init__.py +++ b/matrixai/__init__.py @@ -445,8 +445,12 @@ def run(): async def generate_image(image_prompt, style_value, ratio_value, negative): imagine = AsyncImagine() filename = str(uuid.uuid4()) + ".png" - style_enum = Style[style_value] - ratio_enum = Ratio[ratio_value] + try: + style_enum = Style[style_value] + ratio_enum = Ratio[ratio_value] + except KeyError: + style_enum = Style.IMAGINE_V3 + ratio_enum = Ratio.RATIO_1X1 img_data = await imagine.sdprem( prompt=image_prompt, style=style_enum,