Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -188,11 +188,7 @@ PLACEHOLDER = """
|
|
188 |
</div>
|
189 |
"""
|
190 |
|
191 |
-
|
192 |
-
fn=respond,
|
193 |
-
title="Ginigen Private AI",
|
194 |
-
description="6BIT μμνλ‘ λͺ¨λΈ ν¬κΈ°λ μ€μ΄κ³ μ±λ₯μ μ μ§νλ νλΌμ΄λ²μ μ€μ¬ AI μ루μ
.",
|
195 |
-
theme=gr.themes.Soft(primary_hue="violet", secondary_hue="violet", neutral_hue="gray",font=[gr.themes.GoogleFont("Exo"), "ui-sans-serif", "system-ui", "sans-serif"]).set(
|
196 |
body_background_fill_dark="#16141c",
|
197 |
block_background_fill_dark="#16141c",
|
198 |
block_border_width="1px",
|
@@ -204,27 +200,81 @@ demo = gr.ChatInterface(
|
|
204 |
background_fill_secondary_dark="#16141c",
|
205 |
color_accent_soft_dark="transparent",
|
206 |
code_background_fill_dark="#292733",
|
207 |
-
),
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
gr.
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
|
229 |
if __name__ == "__main__":
|
230 |
demo.launch()
|
|
|
188 |
</div>
|
189 |
"""
|
190 |
|
191 |
+
with gr.Blocks(theme=gr.themes.Soft(primary_hue="violet", secondary_hue="violet", neutral_hue="gray",font=[gr.themes.GoogleFont("Exo"), "ui-sans-serif", "system-ui", "sans-serif"]).set(
|
|
|
|
|
|
|
|
|
192 |
body_background_fill_dark="#16141c",
|
193 |
block_background_fill_dark="#16141c",
|
194 |
block_border_width="1px",
|
|
|
200 |
background_fill_secondary_dark="#16141c",
|
201 |
color_accent_soft_dark="transparent",
|
202 |
code_background_fill_dark="#292733",
|
203 |
+
), css=css) as demo:
|
204 |
+
|
205 |
+
gr.Markdown("# Ginigen Private AI")
|
206 |
+
gr.Markdown("6BIT μμνλ‘ λͺ¨λΈ ν¬κΈ°λ μ€μ΄κ³ μ±λ₯μ μ μ§νλ νλΌμ΄λ²μ μ€μ¬ AI μ루μ
.")
|
207 |
+
|
208 |
+
chatbot = gr.Chatbot(
|
209 |
+
value=[[None, PLACEHOLDER]],
|
210 |
+
height=600,
|
211 |
+
avatar_images=(None, "https://huggingface.co/spaces/ginigen/Private-BitSix-Mistral-Small-3.1-24B-Instruct-2503/resolve/main/llama.jpg"),
|
212 |
+
show_copy_button=True,
|
213 |
+
show_label=False,
|
214 |
+
elem_id="chatbot"
|
215 |
+
)
|
216 |
+
|
217 |
+
with gr.Row():
|
218 |
+
with gr.Column(scale=4):
|
219 |
+
with gr.Row():
|
220 |
+
msg = gr.Textbox(
|
221 |
+
show_label=False,
|
222 |
+
placeholder="λ©μμ§λ₯Ό μ
λ ₯νμΈμ...",
|
223 |
+
container=False,
|
224 |
+
scale=8
|
225 |
+
)
|
226 |
+
submit_btn = gr.Button("μ μ‘", variant="primary", scale=1)
|
227 |
+
|
228 |
+
with gr.Column(scale=1):
|
229 |
+
system_message = gr.Textbox(
|
230 |
+
value="You are a deep thinking AI, you may use extremely long chains of thought to deeply consider the problem and deliberate with yourself via systematic reasoning processes to help come to a correct solution prior to answering. You should enclose your thoughts and internal monologue inside tags, and then provide your solution or response to the problem.",
|
231 |
+
label="μμ€ν
λ©μμ§",
|
232 |
+
lines=5
|
233 |
+
)
|
234 |
+
|
235 |
+
with gr.Accordion("κ³ κΈ μ€μ ", open=False):
|
236 |
+
max_tokens = gr.Slider(minimum=1, maximum=4096, value=2048, step=1, label="μ΅λ ν ν° μ")
|
237 |
+
temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature")
|
238 |
+
top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p")
|
239 |
+
top_k = gr.Slider(minimum=0, maximum=100, value=40, step=1, label="Top-k")
|
240 |
+
repeat_penalty = gr.Slider(minimum=0.0, maximum=2.0, value=1.1, step=0.1, label="Repetition penalty")
|
241 |
+
|
242 |
+
clear_btn = gr.Button("λν μ΄κΈ°ν")
|
243 |
+
|
244 |
+
# Event handlers
|
245 |
+
submit_btn.click(
|
246 |
+
fn=lambda chatbot: chatbot[1:] if chatbot and len(chatbot) > 0 and chatbot[0][0] is None else chatbot,
|
247 |
+
inputs=chatbot,
|
248 |
+
outputs=chatbot,
|
249 |
+
queue=False
|
250 |
+
).then(
|
251 |
+
fn=respond,
|
252 |
+
inputs=[msg, chatbot, system_message, max_tokens, temperature, top_p, top_k, repeat_penalty],
|
253 |
+
outputs=chatbot,
|
254 |
+
queue=True
|
255 |
+
).then(
|
256 |
+
fn=lambda: "",
|
257 |
+
inputs=None,
|
258 |
+
outputs=msg
|
259 |
+
)
|
260 |
+
|
261 |
+
msg.submit(
|
262 |
+
fn=lambda chatbot: chatbot[1:] if chatbot and len(chatbot) > 0 and chatbot[0][0] is None else chatbot,
|
263 |
+
inputs=chatbot,
|
264 |
+
outputs=chatbot,
|
265 |
+
queue=False
|
266 |
+
).then(
|
267 |
+
fn=respond,
|
268 |
+
inputs=[msg, chatbot, system_message, max_tokens, temperature, top_p, top_k, repeat_penalty],
|
269 |
+
outputs=chatbot,
|
270 |
+
queue=True
|
271 |
+
).then(
|
272 |
+
fn=lambda: "",
|
273 |
+
inputs=None,
|
274 |
+
outputs=msg
|
275 |
+
)
|
276 |
+
|
277 |
+
clear_btn.click(lambda: [[None, PLACEHOLDER]], None, chatbot, queue=False)
|
278 |
|
279 |
if __name__ == "__main__":
|
280 |
demo.launch()
|