Commit
•
93f1a1e
1
Parent(s):
fe6d4e0
add model option dropdown
Browse files
app.py
CHANGED
@@ -16,6 +16,7 @@ def respond(
|
|
16 |
max_tokens,
|
17 |
temperature,
|
18 |
top_p,
|
|
|
19 |
):
|
20 |
messages = [{"role": "system", "content": system_message}]
|
21 |
|
@@ -31,7 +32,7 @@ def respond(
|
|
31 |
|
32 |
for message in client.chat_completion(
|
33 |
messages,
|
34 |
-
model="meta-llama/Meta-Llama-3.1-8B-Instruct",
|
35 |
max_tokens=max_tokens,
|
36 |
stream=True,
|
37 |
temperature=temperature,
|
@@ -46,19 +47,27 @@ def respond(
|
|
46 |
"""
|
47 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
48 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
demo = gr.ChatInterface(
|
50 |
respond,
|
51 |
additional_inputs=[
|
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"),
|
55 |
-
gr.Slider(
|
56 |
-
|
57 |
-
maximum=1.0,
|
58 |
-
value=0.95,
|
59 |
-
step=0.05,
|
60 |
-
label="Top-p (nucleus sampling)",
|
61 |
-
),
|
62 |
],
|
63 |
)
|
64 |
|
|
|
16 |
max_tokens,
|
17 |
temperature,
|
18 |
top_p,
|
19 |
+
model,
|
20 |
):
|
21 |
messages = [{"role": "system", "content": system_message}]
|
22 |
|
|
|
32 |
|
33 |
for message in client.chat_completion(
|
34 |
messages,
|
35 |
+
model=model #"meta-llama/Meta-Llama-3.1-8B-Instruct",
|
36 |
max_tokens=max_tokens,
|
37 |
stream=True,
|
38 |
temperature=temperature,
|
|
|
47 |
"""
|
48 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
49 |
"""
|
50 |
+
|
51 |
+
# List of model IDs
|
52 |
+
model_options = [
|
53 |
+
"meta-llama/Meta-Llama-3.1-8B-Instruct",
|
54 |
+
"meta-llama/Meta-Llama-3.1-70B-Instruct",
|
55 |
+
"meta-llama/Meta-Llama-3.1-405B-Instruct-FP8",
|
56 |
+
"meta-llama/Meta-Llama-3-8B-Instruct",
|
57 |
+
"meta-llama/Meta-Llama-3-70B-Instruct",
|
58 |
+
"mistralai/Mistral-7B-Instruct-v0.3",
|
59 |
+
"mistralai/Mixtral-8x7B-Instruct-v0.1",
|
60 |
+
"mistralai/Mixtral-8x22B-Instruct-v0.1",
|
61 |
+
]
|
62 |
+
|
63 |
demo = gr.ChatInterface(
|
64 |
respond,
|
65 |
additional_inputs=[
|
66 |
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
67 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
68 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
69 |
+
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
|
70 |
+
gr.Dropdown(choices=model_options, value=model_options[0], label="Model"), # Dropdown for model selection
|
|
|
|
|
|
|
|
|
|
|
71 |
],
|
72 |
)
|
73 |
|