Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,9 @@ from huggingface_hub import InferenceClient
|
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
|
|
|
|
|
|
|
5 |
|
6 |
def format_prompt(message, history):
|
7 |
prompt = "<s>"
|
@@ -12,18 +15,8 @@ def format_prompt(message, history):
|
|
12 |
return prompt
|
13 |
|
14 |
def generate(
|
15 |
-
|
16 |
):
|
17 |
-
|
18 |
-
if model_version == "1":
|
19 |
-
client = InferenceClient(
|
20 |
-
"mistralai/Mixtral-8x7B-v0.1"
|
21 |
-
)
|
22 |
-
else:
|
23 |
-
client = InferenceClient(
|
24 |
-
"mistralai/Mixtral-8x7B-Instruct-v0.1"
|
25 |
-
)
|
26 |
-
|
27 |
temperature = float(temperature)
|
28 |
if temperature < 1e-2:
|
29 |
temperature = 1e-2
|
@@ -56,13 +49,6 @@ def generate(
|
|
56 |
|
57 |
|
58 |
additional_inputs=[
|
59 |
-
gr.Dropdown(
|
60 |
-
["1", "2"],
|
61 |
-
value="1",
|
62 |
-
interactive=True,
|
63 |
-
label="Mixtral 8x7b mModel Version",
|
64 |
-
info="Choose which Mixtral 8x7b model version to use in the chat"
|
65 |
-
),
|
66 |
gr.Textbox(
|
67 |
label="System Prompt",
|
68 |
interactive=True,
|
@@ -136,4 +122,4 @@ gr.ChatInterface(
|
|
136 |
description="Chatbot Hugging Face space made by [Nick088](https://linktr.ee/Nick088) with costumizable options for model: https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1<br>If you get an erorr, you putted a too much high Max_New_Tokens or your system prompt+prompt is too long, shorten up one of these",
|
137 |
examples=examples,
|
138 |
concurrency_limit=20,
|
139 |
-
).launch(show_api=False)
|
|
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
|
5 |
+
client = InferenceClient(
|
6 |
+
"mistralai/Mixtral-8x7B-Instruct-v0.1"
|
7 |
+
)
|
8 |
|
9 |
def format_prompt(message, history):
|
10 |
prompt = "<s>"
|
|
|
15 |
return prompt
|
16 |
|
17 |
def generate(
|
18 |
+
system_prompt, prompt, history, max_new_tokens, temperature, repetition_penalty, top_p, top_k, seed,
|
19 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
temperature = float(temperature)
|
21 |
if temperature < 1e-2:
|
22 |
temperature = 1e-2
|
|
|
49 |
|
50 |
|
51 |
additional_inputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
gr.Textbox(
|
53 |
label="System Prompt",
|
54 |
interactive=True,
|
|
|
122 |
description="Chatbot Hugging Face space made by [Nick088](https://linktr.ee/Nick088) with costumizable options for model: https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1<br>If you get an erorr, you putted a too much high Max_New_Tokens or your system prompt+prompt is too long, shorten up one of these",
|
123 |
examples=examples,
|
124 |
concurrency_limit=20,
|
125 |
+
).launch(show_api=False, share=True)
|