codelion commited on
Commit
6e74755
1 Parent(s): 4959bf1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -2,13 +2,9 @@ import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  from optillm.moa import mixture_of_agents
4
 
5
- """
6
- For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
7
- """
8
- client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
9
-
10
-
11
  def respond(
 
 
12
  message,
13
  history: list[tuple[str, str]],
14
  system_message,
@@ -16,6 +12,7 @@ def respond(
16
  temperature,
17
  top_p,
18
  ):
 
19
  messages = [{"role": "system", "content": system_message}]
20
 
21
  for val in history:
@@ -48,10 +45,10 @@ demo = gr.ChatInterface(
48
  additional_inputs=[
49
  gr.Dropdown(
50
  ["meta-llama/Meta-Llama-3.1-70B-Instruct", "meta-llama/Meta-Llama-3.1-8B-Instruct", "HuggingFaceH4/zephyr-7b-beta"], label="Model", info="Choose the base model"
51
- )
52
  gr.Dropdown(
53
  ["bon", "mcts", "moa"], label="Approach", info="Choose the approach"
54
- )
55
  gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
56
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
57
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
 
2
  from huggingface_hub import InferenceClient
3
  from optillm.moa import mixture_of_agents
4
 
 
 
 
 
 
 
5
  def respond(
6
+ model,
7
+ approach,
8
  message,
9
  history: list[tuple[str, str]],
10
  system_message,
 
12
  temperature,
13
  top_p,
14
  ):
15
+ client = InferenceClient(model)
16
  messages = [{"role": "system", "content": system_message}]
17
 
18
  for val in history:
 
45
  additional_inputs=[
46
  gr.Dropdown(
47
  ["meta-llama/Meta-Llama-3.1-70B-Instruct", "meta-llama/Meta-Llama-3.1-8B-Instruct", "HuggingFaceH4/zephyr-7b-beta"], label="Model", info="Choose the base model"
48
+ ),
49
  gr.Dropdown(
50
  ["bon", "mcts", "moa"], label="Approach", info="Choose the approach"
51
+ ),
52
  gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
53
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
54
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),