diff --git a/src/utils/agents/persona_generator.py b/src/utils/agents/persona_generator.py index ab97583..3729134 100644 --- a/src/utils/agents/persona_generator.py +++ b/src/utils/agents/persona_generator.py @@ -218,7 +218,7 @@ class PersonaGenerator(Agent): self.username = persona.get("username", None) if not self.username: raise ValueError("LLM did not generate a username") - self.username = re.sub(r'\s+', '.', g) + self.username = re.sub(r'\s+', '.', self.username) user_dir = os.path.join(defines.user_dir, persona["username"]) while os.path.exists(user_dir): match = re.match(r"^(.*?)(\d*)$", persona["username"]) diff --git a/src/utils/image_model_cache.py b/src/utils/image_model_cache.py index 4141661..cca6317 100644 --- a/src/utils/image_model_cache.py +++ b/src/utils/image_model_cache.py @@ -7,8 +7,8 @@ from typing import Any import torch # type: ignore from diffusers import StableDiffusionPipeline, FluxPipeline # type: ignore -class ImageModelCache: - def __init__(self, timeout_seconds: float = 60 * 15): +class ImageModelCache: # Stay loaded for 3 hours + def __init__(self, timeout_seconds: float = 3 * 60 * 60): self._pipe = None self._model_name = None self._device = None diff --git a/src/utils/profile_image.py b/src/utils/profile_image.py index aecf6bf..b33acdf 100644 --- a/src/utils/profile_image.py +++ b/src/utils/profile_image.py @@ -48,7 +48,7 @@ class ImageRequest(BaseModel): guidance_scale: float = 7.5 # Global model cache instance -model_cache = ImageModelCache(timeout_seconds=60 * 15) # 15 minutes +model_cache = ImageModelCache() def flux_worker(pipe: Any, params: ImageRequest, status_queue: queue.Queue, task_id: str): """Background worker for Flux image generation"""