codelion commited on
Commit
786bb0f
1 Parent(s): 7377b55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -1,10 +1,12 @@
1
  import gradio as gr
2
- from huggingface_hub import InferenceClient
3
 
4
  from optillm.moa import mixture_of_agents
5
  from optillm.mcts import chat_with_mcts
6
  from optillm.bon import best_of_n_sampling
7
 
 
 
8
  def respond(
9
  message,
10
  history: list[tuple[str, str]],
@@ -15,7 +17,7 @@ def respond(
15
  temperature,
16
  top_p,
17
  ):
18
- client = InferenceClient(model)
19
 
20
  messages = [{"role": "system", "content": system_message}]
21
 
 
1
  import gradio as gr
2
+ from openai import OpenAI
3
 
4
  from optillm.moa import mixture_of_agents
5
  from optillm.mcts import chat_with_mcts
6
  from optillm.bon import best_of_n_sampling
7
 
8
+ API_KEY = os.environ.get("HF_TOKEN")
9
+
10
  def respond(
11
  message,
12
  history: list[tuple[str, str]],
 
17
  temperature,
18
  top_p,
19
  ):
20
+ client = OpenAI(api_key=API_KEY, base_url="https://api-inference.huggingface.co/models/"+model+"/v1")
21
 
22
  messages = [{"role": "system", "content": system_message}]
23