Add Gemma-based image recognition scaffold

This commit is contained in:
every_holiday
2026-06-09 01:47:46 +09:00
parent cc424dca56
commit fad1a20089
3 changed files with 140 additions and 0 deletions

View File

@@ -69,6 +69,23 @@ def loadOcrConfig():
}
def loadVisionConfig():
config = loadTomlFile(CONFIG_FILE)
vision = config.get("vision", {})
return {
"model_name": str(vision.get("model_name", "google/gemma-3-4b-it")).strip(),
"prompt": str(
vision.get(
"prompt",
"Describe the image briefly and extract any readable text.",
)
).strip(),
"max_new_tokens": int(vision.get("max_new_tokens", 256)),
"temperature": float(vision.get("temperature", 0.2)),
}
def loadVrcLogConfig():
config = loadTomlFile(CONFIG_FILE)
vrc_log = config.get("vrc_log", {})
@@ -108,6 +125,14 @@ def loadVrcLogConfig():
notice_section = event_config.get("notice", {})
missing_count = notice_section.get("missing_count", 0)
log_patterns = (
vrc_log.get("patterns")
or vrc_log.get("log_patterns")
or event_config.get("patterns")
or event_config.get("log_patterns")
or []
)
if not missing_count:
missing_count = event_config.get("missing_count", 0)
@@ -127,4 +152,5 @@ def loadVrcLogConfig():
"staff_names": [str(name).strip() for name in staff_names if str(name).strip()],
"missing_count": int(missing_count),
"self_name": str(self_name).strip(),
"log_patterns": [str(pattern).strip() for pattern in log_patterns if str(pattern).strip()],
}