Spaces:
Running
on
Zero
Running
on
Zero
aixsatoshi
commited on
Commit
•
879bccf
1
Parent(s):
5c36e32
Update app.py
Browse files
app.py
CHANGED
@@ -137,11 +137,10 @@ templates = [
|
|
137 |
"B22", "LLAMA_3", "PHI_3"
|
138 |
]
|
139 |
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
choices=[
|
145 |
'Oumuamua-7b-RP_Q4_K_M.gguf',
|
146 |
'Oumuamua-7b-instruct-v2-Q4_K_M.gguf',
|
147 |
'umiyuki-Umievo-itr012-Gleipnir-7B-Q4_K_M.gguf',
|
@@ -151,47 +150,49 @@ with gr.Blocks() as demo:
|
|
151 |
],
|
152 |
value="Oumuamua-7b-RP_Q4_K_M.gguf",
|
153 |
label="Model"
|
154 |
-
)
|
155 |
-
|
156 |
choices=templates,
|
157 |
value="LLAMA_3",
|
158 |
label="Template"
|
159 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
-
|
162 |
-
|
163 |
-
system_message = gr.Textbox(value="You are a helpful assistant.", label="System message")
|
164 |
-
with gr.Row():
|
165 |
-
max_tokens = gr.Slider(minimum=1, maximum=4096, value=2048, step=1, label="Max tokens")
|
166 |
-
temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature")
|
167 |
-
with gr.Row():
|
168 |
-
top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p")
|
169 |
-
top_k = gr.Slider(minimum=0, maximum=100, value=40, step=1, label="Top-k")
|
170 |
-
with gr.Row():
|
171 |
-
repeat_penalty = gr.Slider(minimum=0.0, maximum=2.0, value=1.1, step=0.1, label="Repetition penalty")
|
172 |
-
|
173 |
-
submit_btn = gr.Button("Send")
|
174 |
-
clear_btn = gr.Button("Clear")
|
175 |
-
undo_btn = gr.Button("Undo")
|
176 |
-
retry_btn = gr.Button("Retry")
|
177 |
-
|
178 |
-
def handle_response(message, history):
|
179 |
-
return list(respond(
|
180 |
-
message,
|
181 |
-
history,
|
182 |
-
model_dropdown.value,
|
183 |
-
system_message.value,
|
184 |
-
max_tokens.value,
|
185 |
-
temperature.value,
|
186 |
-
top_p.value,
|
187 |
-
top_k.value,
|
188 |
-
repeat_penalty.value,
|
189 |
-
template_dropdown.value
|
190 |
-
))
|
191 |
-
|
192 |
-
submit_btn.click(fn=handle_response, inputs=[chatbot.input, chatbot.history], outputs=chatbot)
|
193 |
-
clear_btn.click(lambda: None, None, chatbot)
|
194 |
-
undo_btn.click(lambda x: x[:-1] if x else None, chatbot, chatbot)
|
195 |
-
retry_btn.click(lambda x: x[:-1] if x else None, chatbot, chatbot)
|
196 |
-
|
197 |
-
demo.launch()
|
|
|
137 |
"B22", "LLAMA_3", "PHI_3"
|
138 |
]
|
139 |
|
140 |
+
demo = gr.ChatInterface(
|
141 |
+
fn=respond,
|
142 |
+
inputs=[
|
143 |
+
gr.Dropdown([
|
|
|
144 |
'Oumuamua-7b-RP_Q4_K_M.gguf',
|
145 |
'Oumuamua-7b-instruct-v2-Q4_K_M.gguf',
|
146 |
'umiyuki-Umievo-itr012-Gleipnir-7B-Q4_K_M.gguf',
|
|
|
150 |
],
|
151 |
value="Oumuamua-7b-RP_Q4_K_M.gguf",
|
152 |
label="Model"
|
153 |
+
),
|
154 |
+
gr.Dropdown(
|
155 |
choices=templates,
|
156 |
value="LLAMA_3",
|
157 |
label="Template"
|
158 |
+
),
|
159 |
+
gr.Textbox(value="You are a helpful assistant.", label="System message"),
|
160 |
+
gr.Slider(minimum=1, maximum=4096, value=2048, step=1, label="Max tokens"),
|
161 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
162 |
+
gr.Slider(
|
163 |
+
minimum=0.1,
|
164 |
+
maximum=1.0,
|
165 |
+
value=0.95,
|
166 |
+
step=0.05,
|
167 |
+
label="Top-p",
|
168 |
+
),
|
169 |
+
gr.Slider(
|
170 |
+
minimum=0,
|
171 |
+
maximum=100,
|
172 |
+
value=40,
|
173 |
+
step=1,
|
174 |
+
label="Top-k",
|
175 |
+
),
|
176 |
+
gr.Slider(
|
177 |
+
minimum=0.0,
|
178 |
+
maximum=2.0,
|
179 |
+
value=1.1,
|
180 |
+
step=0.1,
|
181 |
+
label="Repetition penalty",
|
182 |
+
),
|
183 |
+
],
|
184 |
+
retry_btn="Retry",
|
185 |
+
undo_btn="Undo",
|
186 |
+
clear_btn="Clear",
|
187 |
+
submit_btn="Send",
|
188 |
+
title="Chat with various models using llama.cpp",
|
189 |
+
description=description,
|
190 |
+
chatbot=gr.Chatbot(
|
191 |
+
scale=1,
|
192 |
+
likeable=False,
|
193 |
+
show_copy_button=True
|
194 |
+
)
|
195 |
+
)
|
196 |
|
197 |
+
if __name__ == "__main__":
|
198 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|