No hardcoded path/config management — values scattered across files #13

Open
opened 2026-03-19 17:30:58 +00:00 by llabeyrie · 0 comments
Owner

Description

Configuration values are hardcoded throughout the codebase with no centralized config:

Value Location
"runwayml/stable-diffusion-v1-5" card_generator_adapter.py:41
"en_core_web_sm" keyword_extractor.py
"cuda" app.py:38 (hardcoded device)
MAX_SETS = 10000 fetch_card.py:22
MAX_CARDS_PER_SET = 10000 fetch_card.py:23
MAX_WORKERS = 8 fetch_card.py:26
num_inference_steps=30 prompt_to_card_pipeline.py:276
guidance_scale=7.5 prompt_to_card_pipeline.py:277

Problems

  • Changing a model or device requires editing source code
  • app.py hardcodes --device cuda — will fail on CPU-only machines
  • No environment variable support for deployment flexibility

Fix

Create a config.py or use environment variables:

import os
DEVICE = os.getenv("JUICEPYTER_DEVICE", "cpu")
MODEL_ID = os.getenv("JUICEPYTER_MODEL", "runwayml/stable-diffusion-v1-5")
## Description Configuration values are hardcoded throughout the codebase with no centralized config: | Value | Location | |-------|----------| | `"runwayml/stable-diffusion-v1-5"` | `card_generator_adapter.py:41` | | `"en_core_web_sm"` | `keyword_extractor.py` | | `"cuda"` | `app.py:38` (hardcoded device) | | `MAX_SETS = 10000` | `fetch_card.py:22` | | `MAX_CARDS_PER_SET = 10000` | `fetch_card.py:23` | | `MAX_WORKERS = 8` | `fetch_card.py:26` | | `num_inference_steps=30` | `prompt_to_card_pipeline.py:276` | | `guidance_scale=7.5` | `prompt_to_card_pipeline.py:277` | ### Problems - Changing a model or device requires editing source code - `app.py` hardcodes `--device cuda` — will fail on CPU-only machines - No environment variable support for deployment flexibility ### Fix Create a `config.py` or use environment variables: ```python import os DEVICE = os.getenv("JUICEPYTER_DEVICE", "cpu") MODEL_ID = os.getenv("JUICEPYTER_MODEL", "runwayml/stable-diffusion-v1-5") ```
llabeyrie added the priority: mediumstructure labels 2026-03-19 17:31:48 +00:00
Sign in to join this conversation.