add list models
This commit is contained in:
parent
5da32c61e9
commit
265c0f841d
@ -91,6 +91,21 @@ async def enqueue_prompt_t2i(args: dict):
|
|||||||
return await result.json()
|
return await result.json()
|
||||||
|
|
||||||
|
|
||||||
|
async def list_models():
|
||||||
|
url = f"https://{IMAGE_GENERATOR_API_HOST}/prompting/txt2img/"
|
||||||
|
async with aiohttp.ClientSession() as session:
|
||||||
|
headers = {"Authorization":
|
||||||
|
"Bearer " + IMAGE_GENERATOR_TOKEN
|
||||||
|
}
|
||||||
|
|
||||||
|
result = await session.get(
|
||||||
|
url=url,
|
||||||
|
headers=headers,
|
||||||
|
)
|
||||||
|
|
||||||
|
return await result.text()
|
||||||
|
|
||||||
|
|
||||||
def sdxl_image_dimension(value):
|
def sdxl_image_dimension(value):
|
||||||
try:
|
try:
|
||||||
value = int(value)
|
value = int(value)
|
||||||
@ -136,7 +151,6 @@ def create_prompting_parser():
|
|||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument("--checkpoint", type=str,
|
parser.add_argument("--checkpoint", type=str,
|
||||||
choices=["Illustrious-XL-v1.0.safetensors", "PVCStyleModelMovable_illustriousxl10.safetensors"],
|
|
||||||
help="checkpoint to use", required=True)
|
help="checkpoint to use", required=True)
|
||||||
|
|
||||||
parser.add_argument("--prompt", type=str,
|
parser.add_argument("--prompt", type=str,
|
||||||
@ -211,7 +225,14 @@ def prompting_parse_args(args: str, parser: CustomArgParser):
|
|||||||
|
|
||||||
|
|
||||||
async def gen_image(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
async def gen_image(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||||
query = update.message.text.replace("prompting", "").replace("—", "--").replace("\n", "")
|
|
||||||
|
query = update.message.text
|
||||||
|
|
||||||
|
if query.startswith("list models"):
|
||||||
|
models = await list_models()
|
||||||
|
return await context.bot.send_message(chat_id=update.effective_chat.id, text=models)
|
||||||
|
|
||||||
|
query = query.replace("prompting", "").replace("—", "--").replace("\n", "")
|
||||||
|
|
||||||
parser = create_prompting_parser()
|
parser = create_prompting_parser()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user