From 43a51e4060fdc03554d6d4df59c0ffe8779f2a39 Mon Sep 17 00:00:00 2001 From: phixxy Date: Thu, 13 Jul 2023 23:19:10 -0700 Subject: [PATCH] fixed bug in change_model --- sparkytron3000.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sparkytron3000.py b/sparkytron3000.py index 1e79174..effce96 100644 --- a/sparkytron3000.py +++ b/sparkytron3000.py @@ -1208,10 +1208,11 @@ async def change_model(ctx, model_choice='0'): model_id, model_name = model_choices[model_choice] if current_model != model_id: payload = {"sd_model_checkpoint": model_id} - async with session.post(url=f'{url}/sdapi/v1/options', json=payload) as response: - output = "Changed model to: " + model_name - await ctx.send(output) - return + async with aiohttp.ClientSession() as session: + async with session.post(url=f'{url}/sdapi/v1/options', json=payload) as response: + output = "Changed model to: " + model_name + await ctx.send(output) + return else: await ctx.send(f"Already set to use {model_name}") return