Update app.py
Browse files
app.py
CHANGED
|
@@ -25,13 +25,16 @@ def _load_whisper():
|
|
| 25 |
def load_voice():
|
| 26 |
return PiperVoice.load("models/en_US-amy-low.onnx")
|
| 27 |
|
|
|
|
| 28 |
# βββββββββββββββ NEW: Load and embed first aid JSON knowledge βββββββββββββββ
|
| 29 |
@st.cache_resource(show_spinner="Loading embedder and first aid dataβ¦")
|
| 30 |
def load_embedder_and_knowledge():
|
| 31 |
embedder = SentenceTransformer("all-MiniLM-L6-v2")
|
| 32 |
# Load JSON knowledge base (adjust path if needed)
|
| 33 |
with open("first_aid_intents.json", "r", encoding="utf-8") as f:
|
| 34 |
-
|
|
|
|
|
|
|
| 35 |
# Flatten all patterns+responses as docs
|
| 36 |
docs = []
|
| 37 |
for intent in intents:
|
|
|
|
| 25 |
def load_voice():
|
| 26 |
return PiperVoice.load("models/en_US-amy-low.onnx")
|
| 27 |
|
| 28 |
+
|
| 29 |
# βββββββββββββββ NEW: Load and embed first aid JSON knowledge βββββββββββββββ
|
| 30 |
@st.cache_resource(show_spinner="Loading embedder and first aid dataβ¦")
|
| 31 |
def load_embedder_and_knowledge():
|
| 32 |
embedder = SentenceTransformer("all-MiniLM-L6-v2")
|
| 33 |
# Load JSON knowledge base (adjust path if needed)
|
| 34 |
with open("first_aid_intents.json", "r", encoding="utf-8") as f:
|
| 35 |
+
data = json.load(f)
|
| 36 |
+
intents = data.get("intents", []) # β
FIX: Extract list from top-level "intents"
|
| 37 |
+
|
| 38 |
# Flatten all patterns+responses as docs
|
| 39 |
docs = []
|
| 40 |
for intent in intents:
|