Spaces:
Running
on
Zero
Running
on
Zero
UI and Model
#4
by
KingNish
- opened
app.py
CHANGED
@@ -52,14 +52,23 @@ def write_message_to_user():
|
|
52 |
def respond(
|
53 |
message,
|
54 |
history: list[tuple[str, str]],
|
55 |
-
model,
|
56 |
-
system_message,
|
57 |
-
max_tokens,
|
58 |
-
temperature,
|
59 |
-
top_p,
|
60 |
-
top_k,
|
61 |
-
repeat_penalty,
|
62 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
chat_template = get_messages_formatter_type(model)
|
64 |
llm = Llama(
|
65 |
model_path=f"models/{model}",
|
@@ -160,11 +169,11 @@ demo = gr.ChatInterface(
|
|
160 |
respond,
|
161 |
additional_inputs=[
|
162 |
gr.Dropdown([
|
163 |
-
'Mistral
|
164 |
-
'
|
165 |
-
'
|
166 |
],
|
167 |
-
value="Mistral
|
168 |
label="Model"
|
169 |
),
|
170 |
gr.Textbox(value=web_search_system_prompt, label="System message"),
|
@@ -193,8 +202,8 @@ demo = gr.ChatInterface(
|
|
193 |
),
|
194 |
],
|
195 |
theme=gr.themes.Soft(
|
196 |
-
primary_hue="
|
197 |
-
secondary_hue="
|
198 |
neutral_hue="gray",
|
199 |
font=[gr.themes.GoogleFont("Exo"), "ui-sans-serif", "system-ui", "sans-serif"]).set(
|
200 |
body_background_fill_dark="#0c0505",
|
|
|
52 |
def respond(
|
53 |
message,
|
54 |
history: list[tuple[str, str]],
|
55 |
+
model = 'Mistral-7B-Instruct-v0.3-Q6_K.gguf',
|
56 |
+
system_message = 'Helpful assistant',
|
57 |
+
max_tokens = 2048,
|
58 |
+
temperature = 0.45,
|
59 |
+
top_p = 0.95,
|
60 |
+
top_k = 40,
|
61 |
+
repeat_penalty = 1.1,
|
62 |
):
|
63 |
+
|
64 |
+
if "Mistral" in model:
|
65 |
+
model = 'Mistral-7B-Instruct-v0.3-Q6_K.gguf'
|
66 |
+
elif "Mixtral" in model:
|
67 |
+
model = 'mixtral-8x7b-instruct-v0.1.Q5_K_M.gguf'
|
68 |
+
else:
|
69 |
+
model = 'Meta-Llama-3-8B-Instruct-Q6_K.gguf'
|
70 |
+
yield model
|
71 |
+
|
72 |
chat_template = get_messages_formatter_type(model)
|
73 |
llm = Llama(
|
74 |
model_path=f"models/{model}",
|
|
|
169 |
respond,
|
170 |
additional_inputs=[
|
171 |
gr.Dropdown([
|
172 |
+
'Mistral 7B Instruct v0.3',
|
173 |
+
'Mixtral 8x7b Instruct v0.1',
|
174 |
+
'Llama 3 8B Instruct'
|
175 |
],
|
176 |
+
value="Mistral 7B Instruct v0.3",
|
177 |
label="Model"
|
178 |
),
|
179 |
gr.Textbox(value=web_search_system_prompt, label="System message"),
|
|
|
202 |
),
|
203 |
],
|
204 |
theme=gr.themes.Soft(
|
205 |
+
primary_hue="green",
|
206 |
+
secondary_hue="lime",
|
207 |
neutral_hue="gray",
|
208 |
font=[gr.themes.GoogleFont("Exo"), "ui-sans-serif", "system-ui", "sans-serif"]).set(
|
209 |
body_background_fill_dark="#0c0505",
|
ui.py
CHANGED
@@ -28,7 +28,7 @@ PLACEHOLDER = """
|
|
28 |
</figure>
|
29 |
<div style="padding: .5rem 1.5rem;">
|
30 |
<h2 style="text-align: left; font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem;">llama-cpp-agent</h2>
|
31 |
-
<p style="text-align: left; font-size: 16px; line-height: 1.5; margin-bottom: 15px;">DDG Agent
|
32 |
<div style="display: flex; justify-content: space-between; align-items: center;">
|
33 |
<div style="display: flex; flex-flow: column; justify-content: space-between;">
|
34 |
<span style="display: inline-flex; align-items: center; border-radius: 0.375rem; background-color: rgba(229, 70, 77, 0.1); padding: 0.1rem 0.75rem; font-size: 0.75rem; font-weight: 500; color: #f88181; margin-bottom: 2.5px;">
|
|
|
28 |
</figure>
|
29 |
<div style="padding: .5rem 1.5rem;">
|
30 |
<h2 style="text-align: left; font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem;">llama-cpp-agent</h2>
|
31 |
+
<p style="text-align: left; font-size: 16px; line-height: 1.5; margin-bottom: 15px;">DDG Agent enables users to interact using natural language and can answer queries with the latest information from the web, which standard LLMs are unable to provide.</p>
|
32 |
<div style="display: flex; justify-content: space-between; align-items: center;">
|
33 |
<div style="display: flex; flex-flow: column; justify-content: space-between;">
|
34 |
<span style="display: inline-flex; align-items: center; border-radius: 0.375rem; background-color: rgba(229, 70, 77, 0.1); padding: 0.1rem 0.75rem; font-size: 0.75rem; font-weight: 500; color: #f88181; margin-bottom: 2.5px;">
|