Tonic commited on
Commit
e82969b
·
unverified ·
1 Parent(s): 4bb7d6f

add inference client

Browse files
Files changed (1) hide show
  1. utils/oneclick.py +8 -1
utils/oneclick.py CHANGED
@@ -5,9 +5,16 @@ from .responseparser import PatientDataExtractor
5
  from .pdfutils import PDFGenerator
6
  import logging
7
  import json
 
8
 
9
  logger = logging.getLogger(__name__)
10
 
 
 
 
 
 
 
11
  def generate_ai_discharge_summary(patient_dict: Dict[str, str], client) -> Optional[str]:
12
  """Generate a discharge summary using AI based on extracted patient data."""
13
  try:
@@ -27,7 +34,7 @@ def generate_ai_discharge_summary(patient_dict: Dict[str, str], client) -> Optio
27
  ]
28
 
29
  stream = client.chat.completions.create(
30
- model="grok-3",
31
  messages=messages,
32
  temperature=0.4,
33
  max_tokens=3584,
 
5
  from .pdfutils import PDFGenerator
6
  import logging
7
  import json
8
+ from huggingface_hub import InferenceClient
9
 
10
  logger = logging.getLogger(__name__)
11
 
12
+ HF_TOKEN = os.getenv("HF_TOKEN")
13
+ if not HF_TOKEN:
14
+ raise ValueError("HF_TOKEN environment variable not set.")
15
+ client = InferenceClient(api_key=HF_TOKEN)
16
+ MODEL_NAME = "meta-llama/Llama-3.3-70B-Instruct"
17
+
18
  def generate_ai_discharge_summary(patient_dict: Dict[str, str], client) -> Optional[str]:
19
  """Generate a discharge summary using AI based on extracted patient data."""
20
  try:
 
34
  ]
35
 
36
  stream = client.chat.completions.create(
37
+ model=MODEL_NAME,
38
  messages=messages,
39
  temperature=0.4,
40
  max_tokens=3584,