bkhmsi commited on
Commit
a11e2a7
·
1 Parent(s): 5f411d7
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -34,7 +34,6 @@ from router_backend import get_expert_routing
34
  # BACKEND_AVAILABLE = False
35
  # _backend_import_error = e
36
 
37
- HF_TOKEN: str = os.getenv("HF_TOKEN")
38
 
39
  EXPERTS = ["Language", "Logic", "Social", "World"]
40
 
@@ -99,8 +98,7 @@ def route_and_plot(
99
  - Call backend (real or mock)
100
  - Return a table + bar plot + status message
101
  """
102
- if HF_TOKEN.strip() == "":
103
- HF_TOKEN = None # allow empty token
104
 
105
  ablations = []
106
  if ablate_language:
@@ -133,7 +131,7 @@ def route_and_plot(
133
  generation = None
134
  else:
135
  try:
136
- raw, generation = get_expert_routing(model_id, HF_TOKEN, prompt, ablations) # <-- your real function
137
  vals = _normalize_output(raw)
138
  msg = "Routed with real backend."
139
  except Exception as e:
@@ -241,7 +239,8 @@ with gr.Blocks(theme=gr.themes.Soft(), fill_height=True) as demo:
241
  gr.Examples(
242
  examples=examples,
243
  inputs=[model_choice, user_prompt, assistant_prompt, ablate_language, ablate_logic, ablate_social, ablate_world],
244
- label="Try these examples:"
 
245
  )
246
 
247
  if __name__ == "__main__":
 
34
  # BACKEND_AVAILABLE = False
35
  # _backend_import_error = e
36
 
 
37
 
38
  EXPERTS = ["Language", "Logic", "Social", "World"]
39
 
 
98
  - Call backend (real or mock)
99
  - Return a table + bar plot + status message
100
  """
101
+ hf_token = os.getenv("HF_TOKEN")
 
102
 
103
  ablations = []
104
  if ablate_language:
 
131
  generation = None
132
  else:
133
  try:
134
+ raw, generation = get_expert_routing(model_id, hf_token, prompt, ablations) # <-- your real function
135
  vals = _normalize_output(raw)
136
  msg = "Routed with real backend."
137
  except Exception as e:
 
239
  gr.Examples(
240
  examples=examples,
241
  inputs=[model_choice, user_prompt, assistant_prompt, ablate_language, ablate_logic, ablate_social, ablate_world],
242
+ label="Try these examples:",
243
+ cache_examples=True,
244
  )
245
 
246
  if __name__ == "__main__":