Spaces:
Runtime error
Runtime error
updated LLM loading code
Browse files
crew.py
CHANGED
|
@@ -9,6 +9,7 @@ from dataloaderImp import *
|
|
| 9 |
from typing import Union
|
| 10 |
import shap
|
| 11 |
import xgboost as xgb
|
|
|
|
| 12 |
|
| 13 |
# Load audio model & metadata
|
| 14 |
audio_model = xgb.Booster()
|
|
@@ -324,22 +325,14 @@ def explain_dementia_risk_lifestyle(docID: str) -> str:
|
|
| 324 |
except Exception as e:
|
| 325 |
return f"SHAP explanation failed: {str(e)}"
|
| 326 |
|
| 327 |
-
# OLD (won't work on HF):
|
| 328 |
-
# llm = LLM(model="ollama/llama3.1:8b")
|
| 329 |
|
| 330 |
-
#
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
model="huggingfacehub",
|
| 336 |
-
base_url="https://router.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.2",
|
| 337 |
-
api_key=os.getenv("HF_Token"),
|
| 338 |
-
temperature=0.7,
|
| 339 |
-
max_tokens=512
|
| 340 |
)
|
| 341 |
|
| 342 |
-
|
| 343 |
# Define agents for Alzheimer's detection system
|
| 344 |
risk_calculator_audio = Agent(
|
| 345 |
role="Risk Calculator Audio Agent",
|
|
|
|
| 9 |
from typing import Union
|
| 10 |
import shap
|
| 11 |
import xgboost as xgb
|
| 12 |
+
from langchain import HuggingFaceHub
|
| 13 |
|
| 14 |
# Load audio model & metadata
|
| 15 |
audio_model = xgb.Booster()
|
|
|
|
| 325 |
except Exception as e:
|
| 326 |
return f"SHAP explanation failed: {str(e)}"
|
| 327 |
|
|
|
|
|
|
|
| 328 |
|
| 329 |
+
# Load LLM from huggingface repos
|
| 330 |
+
llm = HuggingFaceHub(
|
| 331 |
+
repo_id="mistralai/Mistral-7B-Instruct-v0.2",
|
| 332 |
+
model_kwargs={"temperature":0.7, "max_new_tokens":512},
|
| 333 |
+
huggingfacehub_api_token=os.getenv("HF_TOKEN")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
)
|
| 335 |
|
|
|
|
| 336 |
# Define agents for Alzheimer's detection system
|
| 337 |
risk_calculator_audio = Agent(
|
| 338 |
role="Risk Calculator Audio Agent",
|