This commit is contained in:
James Ketr 2025-05-22 17:03:53 -07:00
parent a6ff43af1d
commit ceb96d1bd5
3 changed files with 4 additions and 4 deletions

View File

@ -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"])

View File

@ -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

View File

@ -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"""