Basementup commited on
Commit
c51fae4
·
verified ·
1 Parent(s): f11cbd8

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -18,29 +18,29 @@ import PyPDF2
18
  SAVE_DIR = Path("/data/saved_docs")
19
  SAVE_DIR.mkdir(parents=True, exist_ok=True)
20
 
21
- MODEL = "mistralai/Mistral-7B-Instruct-v0.3"
22
 
23
 
24
  # =========================
25
  # SHARED: TOKEN / MODEL / TTS
26
  # =========================
27
 
28
- def get_client():
29
- token = os.environ.get("HF_TOKEN", "")
30
- return InferenceClient(model=MODEL, token=token if token else None)
31
 
32
 
33
  def call_llama(prompt, max_tokens=1200):
34
  try:
35
- client = get_client()
36
  response = client.chat_completion(
37
  messages=[{"role": "user", "content": prompt}],
38
  max_tokens=max_tokens,
39
  temperature=0.4,
40
  )
 
41
  if hasattr(response, "choices") and response.choices:
42
  return response.choices[0].message.content
 
43
  return f"No model output returned. Raw response: {response}"
 
44
  except Exception as e:
45
  return f"Model error: {e}"
46
 
 
18
  SAVE_DIR = Path("/data/saved_docs")
19
  SAVE_DIR.mkdir(parents=True, exist_ok=True)
20
 
21
+ MODEL = "meta-llama/Llama-3.3-70B-Instruct"
22
 
23
 
24
  # =========================
25
  # SHARED: TOKEN / MODEL / TTS
26
  # =========================
27
 
28
+ client = InferenceClient("meta-llama/Llama-3.3-70B-Instruct")
 
 
29
 
30
 
31
  def call_llama(prompt, max_tokens=1200):
32
  try:
 
33
  response = client.chat_completion(
34
  messages=[{"role": "user", "content": prompt}],
35
  max_tokens=max_tokens,
36
  temperature=0.4,
37
  )
38
+
39
  if hasattr(response, "choices") and response.choices:
40
  return response.choices[0].message.content
41
+
42
  return f"No model output returned. Raw response: {response}"
43
+
44
  except Exception as e:
45
  return f"Model error: {e}"
46