Commit
·
df728ac
1
Parent(s):
2c3da68
fix model selection
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ from huggingface_hub import InferenceClient
|
|
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 |
|
11 |
def respond(
|
@@ -17,7 +17,6 @@ def respond(
|
|
17 |
temperature,
|
18 |
top_p,
|
19 |
):
|
20 |
-
client = InferenceClient(model=model)
|
21 |
messages = [{"role": "system", "content": system_message}]
|
22 |
|
23 |
for val in history:
|
@@ -36,6 +35,7 @@ def respond(
|
|
36 |
stream=True,
|
37 |
temperature=temperature,
|
38 |
top_p=top_p,
|
|
|
39 |
):
|
40 |
token = message.choices[0].delta.content
|
41 |
|
@@ -51,7 +51,7 @@ model_choices = [
|
|
51 |
"lab2-as/lora_model",
|
52 |
]
|
53 |
demo = gr.ChatInterface(
|
54 |
-
|
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"),
|
|
|
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()
|
9 |
|
10 |
|
11 |
def respond(
|
|
|
17 |
temperature,
|
18 |
top_p,
|
19 |
):
|
|
|
20 |
messages = [{"role": "system", "content": system_message}]
|
21 |
|
22 |
for val in history:
|
|
|
35 |
stream=True,
|
36 |
temperature=temperature,
|
37 |
top_p=top_p,
|
38 |
+
model=model,
|
39 |
):
|
40 |
token = message.choices[0].delta.content
|
41 |
|
|
|
51 |
"lab2-as/lora_model",
|
52 |
]
|
53 |
demo = gr.ChatInterface(
|
54 |
+
respond,
|
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"),
|