Rb1215 commited on
Commit
abd5e17
·
verified ·
1 Parent(s): 01617e9

use public token

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -138,20 +138,15 @@ def augment_user_message(user_msg: str, context: str) -> str:
138
  f"{context}\n\n"
139
  f"User question: {user_msg}"
140
  )
141
-
142
- def respond(
143
- message,
144
- history: list[dict[str, str]],
145
- system_message,
146
- max_tokens,
147
- temperature,
148
- top_p,
149
- hf_token: gr.OAuthToken,
150
- ):
151
  """
152
  Augments the conversation with CSV-derived context as SYSTEM messages before calling the model.
153
  """
154
- client = InferenceClient(token=hf_token.token, model="openai/gpt-oss-20b")
155
 
156
  # 1) Retrieve CSV context for the latest user message
157
  retrieved = RAG.retrieve(message, k=10)
 
138
  f"{context}\n\n"
139
  f"User question: {user_msg}"
140
  )
141
+ def respond(message, history, system_message, max_tokens, temperature, top_p):
142
+ token = os.getenv("HF_TOKEN") # Space Secret or env var
143
+ if not token:
144
+ yield "⚠️ No HF token found on the server. Please set HF_TOKEN in the Space secrets."
145
+ return
 
 
 
 
 
146
  """
147
  Augments the conversation with CSV-derived context as SYSTEM messages before calling the model.
148
  """
149
+ client = InferenceClient(token=token, model="openai/gpt-oss-20b")
150
 
151
  # 1) Retrieve CSV context for the latest user message
152
  retrieved = RAG.retrieve(message, k=10)