added -> theme, examples, textbox
Browse files
app.py
CHANGED
@@ -5,6 +5,8 @@ from ctransformers import AutoTokenizer, AutoModelForCausalLM
|
|
5 |
model_id = "TheBloke/Mistral-7B-Instruct-v0.1-GGUF"
|
6 |
model_file = "mistral-7b-instruct-v0.1.Q4_K_M.gguf"
|
7 |
model_type = "mistral"
|
|
|
|
|
8 |
quant_model = AutoModelForCausalLM.from_pretrained(model_id, model_file = model_file , model_type= model_type)
|
9 |
|
10 |
|
@@ -31,10 +33,16 @@ def lechat_respond(
|
|
31 |
yield response
|
32 |
|
33 |
|
|
|
34 |
mistral_chat = gr.ChatInterface(
|
35 |
fn = lechat_respond,
|
36 |
type = 'messages',
|
37 |
additional_inputs=[
|
|
|
|
|
|
|
|
|
|
|
38 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
39 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.8, step=0.1, label="Temperature"),
|
40 |
gr.Slider(
|
@@ -44,7 +52,7 @@ mistral_chat = gr.ChatInterface(
|
|
44 |
step=0.05,
|
45 |
label="Top-p (nucleus sampling)",
|
46 |
),
|
47 |
-
gr.Slider(minimum = 40, maximum =
|
48 |
],
|
49 |
)
|
50 |
|
|
|
5 |
model_id = "TheBloke/Mistral-7B-Instruct-v0.1-GGUF"
|
6 |
model_file = "mistral-7b-instruct-v0.1.Q4_K_M.gguf"
|
7 |
model_type = "mistral"
|
8 |
+
|
9 |
+
# it's a quantization model
|
10 |
quant_model = AutoModelForCausalLM.from_pretrained(model_id, model_file = model_file , model_type= model_type)
|
11 |
|
12 |
|
|
|
33 |
yield response
|
34 |
|
35 |
|
36 |
+
#chat interface for le_chat
|
37 |
mistral_chat = gr.ChatInterface(
|
38 |
fn = lechat_respond,
|
39 |
type = 'messages',
|
40 |
additional_inputs=[
|
41 |
+
textbox = gr.Textbox(placeholder= "Ask whatever"),
|
42 |
+
theme= "ocean",
|
43 |
+
examples= [["Write a haiku about destruction of human's and the raise of AI "],
|
44 |
+
["Which species will rule the earth in the future"]],
|
45 |
+
cache_examples= True,
|
46 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
47 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.8, step=0.1, label="Temperature"),
|
48 |
gr.Slider(
|
|
|
52 |
step=0.05,
|
53 |
label="Top-p (nucleus sampling)",
|
54 |
),
|
55 |
+
gr.Slider(minimum = 40, maximum = 10000, value = 40, step = 10, label = "Top-k")
|
56 |
],
|
57 |
)
|
58 |
|