Spaces:
Sleeping
Sleeping
Commit
·
38d3125
1
Parent(s):
7684e5b
app.py
CHANGED
|
@@ -259,15 +259,21 @@ for muscle, words in muscle_keywords.items():
|
|
| 259 |
# -------------------------
|
| 260 |
# Helpers: detectar conceitos e músculos
|
| 261 |
# -------------------------
|
| 262 |
-
def detectar_conceitos(prompt_emb):
|
| 263 |
matches = []
|
| 264 |
for concept, c_emb in concept_embeddings.items():
|
| 265 |
sim = float(util.cos_sim(prompt_emb, c_emb).item())
|
| 266 |
if sim >= KW_SIM_THRESHOLD:
|
| 267 |
matches.append((concept, sim))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
return matches
|
| 269 |
|
| 270 |
|
|
|
|
| 271 |
def detectar_musculos(texto: str) -> list[str]:
|
| 272 |
texto = texto.lower()
|
| 273 |
detectados = set()
|
|
|
|
| 259 |
# -------------------------
|
| 260 |
# Helpers: detectar conceitos e músculos
|
| 261 |
# -------------------------
|
| 262 |
+
def detectar_conceitos(prompt_emb, prompt_norm):
|
| 263 |
matches = []
|
| 264 |
for concept, c_emb in concept_embeddings.items():
|
| 265 |
sim = float(util.cos_sim(prompt_emb, c_emb).item())
|
| 266 |
if sim >= KW_SIM_THRESHOLD:
|
| 267 |
matches.append((concept, sim))
|
| 268 |
+
|
| 269 |
+
# fallback por regex
|
| 270 |
+
if any(k in prompt_norm for k in ["emagrecer", "perder peso", "cutting", "bulking", "secar", "ganhar massa", "ganhara peso"]):
|
| 271 |
+
matches.append(("dieta", 1.0))
|
| 272 |
+
|
| 273 |
return matches
|
| 274 |
|
| 275 |
|
| 276 |
+
|
| 277 |
def detectar_musculos(texto: str) -> list[str]:
|
| 278 |
texto = texto.lower()
|
| 279 |
detectados = set()
|