Spaces:
Sleeping
Sleeping
Update health_tracker_agent.py
Browse files- health_tracker_agent.py +14 -8
health_tracker_agent.py
CHANGED
@@ -1,11 +1,17 @@
|
|
1 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
2 |
-
import
|
|
|
|
|
|
|
|
|
3 |
|
4 |
-
def track_health_status(health_input):
|
5 |
model_name = "m42-health/med42-70b"
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
1 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
2 |
+
from huggingface_hub import login
|
3 |
+
|
4 |
+
def track_health_status(input_text: str) -> str:
|
5 |
+
# Authenticate
|
6 |
+
login("your_huggingface_token_here") # <-- replace with your actual token
|
7 |
|
|
|
8 |
model_name = "m42-health/med42-70b"
|
9 |
+
|
10 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, use_auth_token=True)
|
11 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, use_auth_token=True)
|
12 |
+
|
13 |
+
inputs = tokenizer.encode(input_text, return_tensors="pt", truncation=True)
|
14 |
+
outputs = model.generate(inputs, max_length=512)
|
15 |
+
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
16 |
+
|
17 |
+
return result
|