Spaces:
Sleeping
Sleeping
kamran-r123
commited on
Create kminterface.py
Browse files- kminterface.py +54 -0
kminterface.py
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from huggingface_hub import InferenceClient
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
additional_inputs=[
|
9 |
+
gr.Textbox(
|
10 |
+
label="System Prompt",
|
11 |
+
max_lines=1,
|
12 |
+
interactive=True,
|
13 |
+
),
|
14 |
+
gr.Slider(
|
15 |
+
label="Temperature",
|
16 |
+
value=0.2,
|
17 |
+
minimum=0.0,
|
18 |
+
maximum=1.0,
|
19 |
+
step=0.05,
|
20 |
+
interactive=True,
|
21 |
+
info="Higher values produce more diverse outputs",
|
22 |
+
),
|
23 |
+
gr.Slider(
|
24 |
+
label="Max new tokens",
|
25 |
+
value=512,
|
26 |
+
minimum=0,
|
27 |
+
maximum=1048,
|
28 |
+
step=64,
|
29 |
+
interactive=True,
|
30 |
+
info="The maximum numbers of new tokens",
|
31 |
+
),
|
32 |
+
gr.Slider(
|
33 |
+
label="Top-p (nucleus sampling)",
|
34 |
+
value=0.95,
|
35 |
+
minimum=0.0,
|
36 |
+
maximum=1,
|
37 |
+
step=0.05,
|
38 |
+
interactive=True,
|
39 |
+
info="Higher values sample more low-probability tokens",
|
40 |
+
),
|
41 |
+
gr.Slider(
|
42 |
+
label="Repetition penalty",
|
43 |
+
value=1,
|
44 |
+
minimum=1.0,
|
45 |
+
maximum=2.0,
|
46 |
+
step=0.05,
|
47 |
+
interactive=True,
|
48 |
+
info="Penalize repeated tokens",
|
49 |
+
)
|
50 |
+
]
|
51 |
+
|
52 |
+
mychatbot = gr.Chatbot(
|
53 |
+
avatar_images=["./user.png", "./botm.png"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=False)
|
54 |
+
|