feat: refactor code and finetune OOM fix

This commit is contained in:
zin
2026-06-03 09:34:34 +00:00
parent e3a2eb3289
commit 8648e52106
8 changed files with 26 additions and 52 deletions
-2
View File
@@ -6,14 +6,12 @@ import requests
class LLMAcousticBridge:
def __init__(self, model_name="dolphin-llama3:8b"):
self.model_name = model_name
# Динамический выбор URL (внутри Docker используется emom_ollama)
base_url = os.getenv("OLLAMA_API_URL", "http://emom_ollama:11434")
self.api_url = f"{base_url}/api/generate"
def get_acoustic_profile(self, valence, arousal, semantics):
context_str = ", ".join(semantics) if semantics else "abstract scene"
# Строгий промпт с примером вывода
prompt = f"""
Analyze the visual context and emotions to determine the ideal background music properties.
Emotions: Valence {valence:.1f}/9.0 (Positivity), Arousal {arousal:.1f}/9.0 (Energy).