Commit
·
2c3da68
1
Parent(s):
7e8d773
added model selection
Browse files
app.py
CHANGED
@@ -4,17 +4,20 @@ from huggingface_hub import InferenceClient
|
|
4 |
"""
|
5 |
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
|
6 |
"""
|
7 |
-
|
|
|
8 |
|
9 |
|
10 |
def respond(
|
11 |
message,
|
12 |
history: list[tuple[str, str]],
|
|
|
13 |
system_message,
|
14 |
max_tokens,
|
15 |
temperature,
|
16 |
top_p,
|
17 |
):
|
|
|
18 |
messages = [{"role": "system", "content": system_message}]
|
19 |
|
20 |
for val in history:
|
@@ -43,11 +46,16 @@ def respond(
|
|
43 |
"""
|
44 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
45 |
"""
|
|
|
|
|
|
|
|
|
46 |
demo = gr.ChatInterface(
|
47 |
-
respond,
|
48 |
additional_inputs=[
|
|
|
49 |
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
50 |
-
gr.Slider(minimum=1, maximum=2048, value=
|
51 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
52 |
gr.Slider(
|
53 |
minimum=0.1,
|
|
|
4 |
"""
|
5 |
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
|
6 |
"""
|
7 |
+
|
8 |
+
#client = InferenceClient(model="lab2-as/lora_model_gguf")
|
9 |
|
10 |
|
11 |
def respond(
|
12 |
message,
|
13 |
history: list[tuple[str, str]],
|
14 |
+
model,
|
15 |
system_message,
|
16 |
max_tokens,
|
17 |
temperature,
|
18 |
top_p,
|
19 |
):
|
20 |
+
client = InferenceClient(model=model)
|
21 |
messages = [{"role": "system", "content": system_message}]
|
22 |
|
23 |
for val in history:
|
|
|
46 |
"""
|
47 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
48 |
"""
|
49 |
+
model_choices = [
|
50 |
+
"lab2-as/lora_model_gguf",
|
51 |
+
"lab2-as/lora_model",
|
52 |
+
]
|
53 |
demo = gr.ChatInterface(
|
54 |
+
lambda *args: respond(*args),
|
55 |
additional_inputs=[
|
56 |
+
gr.Dropdown(choices=model_choices, value=model_choices[0], label="Select Model"),
|
57 |
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
58 |
+
gr.Slider(minimum=1, maximum=2048, value=128, step=1, label="Max new tokens"),
|
59 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
60 |
gr.Slider(
|
61 |
minimum=0.1,
|