Skip to content

Commit b59a1ee

Browse files
added unified layer for the image based models
1 parent 09f5dd6 commit b59a1ee

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
load_dotenv(override=True)
1414

15+
# Allowed image generation models
16+
ALLOWED_MODELS = {"flux", "klein", "klein-large", "zimage"}
17+
1518

1619
class BotConfig(BaseModel):
1720
command_prefix: str

utils/image_gen_utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77
import json
88
from PIL import Image
99
from exceptions import PromptTooLongError, DimensionTooSmallError, APIError
10-
from config import config
10+
from config import config, ALLOWED_MODELS
1111
import os
1212
from dotenv import load_dotenv
1313
load_dotenv()
1414

1515
__all__: list[str] = ("generate_image", "validate_prompt", "validate_dimensions", "validate_model")
1616

17-
ALLOWED_MODELS = {"flux", "klein", "klein-large", "zimage"}
18-
1917

2018
def validate_prompt(prompt) -> None:
2119
if len(prompt) > config.image_generation.validation.max_prompt_length:

utils/models.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
from config import initialize_models_async
1+
from config import initialize_models_async, ALLOWED_MODELS
22
from utils.logger import discord_logger
33

44

5-
ALLOWED_MODELS = {"flux", "klein", "klein-large", "zimage"}
6-
7-
85
async def fetch_and_log_models(config, action: str) -> None:
96
"""
107
Fetch models from API and update config with proper logging.

0 commit comments

Comments
 (0)