fix: service

This commit is contained in:
0xMRTT 2023-06-08 20:25:28 +02:00
parent 8fd7950a62
commit b10685cc06
Signed by: 0xMRTT
GPG Key ID: 910B287304120902
2 changed files with 12 additions and 4 deletions

View File

@ -1,7 +1,11 @@
[Unit] [Unit]
Description=Matrix AI Description=Matrix AI
After=multi-user.target[Service] After=multi-user.target
[Service]
Type=simple Type=simple
Restart=always Restart=always
ExecStart=/usr/bin/python3 /home/0xmrtt/matrixai/run.sh ExecStart=/home/0xmrtt/matrixai/run.sh
[Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -445,8 +445,12 @@ def run():
async def generate_image(image_prompt, style_value, ratio_value, negative): async def generate_image(image_prompt, style_value, ratio_value, negative):
imagine = AsyncImagine() imagine = AsyncImagine()
filename = str(uuid.uuid4()) + ".png" filename = str(uuid.uuid4()) + ".png"
try:
style_enum = Style[style_value] style_enum = Style[style_value]
ratio_enum = Ratio[ratio_value] ratio_enum = Ratio[ratio_value]
except KeyError:
style_enum = Style.IMAGINE_V3
ratio_enum = Ratio.RATIO_1X1
img_data = await imagine.sdprem( img_data = await imagine.sdprem(
prompt=image_prompt, prompt=image_prompt,
style=style_enum, style=style_enum,