Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -188,7 +188,26 @@ PLACEHOLDER = """
|
|
188 |
</div>
|
189 |
"""
|
190 |
|
191 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
body_background_fill_dark="#16141c",
|
193 |
block_background_fill_dark="#16141c",
|
194 |
block_border_width="1px",
|
@@ -200,68 +219,15 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="violet", secondary_hue="violet"
|
|
200 |
background_fill_secondary_dark="#16141c",
|
201 |
color_accent_soft_dark="transparent",
|
202 |
code_background_fill_dark="#292733",
|
203 |
-
),
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
placeholder=PLACEHOLDER,
|
213 |
-
show_copy_button=True,
|
214 |
-
type="messages" # Deprecation κ²½κ³ λ°©μ§
|
215 |
-
)
|
216 |
-
|
217 |
-
with gr.Row():
|
218 |
-
msg = gr.Textbox(
|
219 |
-
show_label=False,
|
220 |
-
placeholder="λ©μμ§λ₯Ό μ
λ ₯νμΈμ...",
|
221 |
-
container=False
|
222 |
-
)
|
223 |
-
submit_btn = gr.Button("μ μ‘", variant="primary")
|
224 |
-
|
225 |
-
with gr.Column(scale=1):
|
226 |
-
system_message = gr.Textbox(
|
227 |
-
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.",
|
228 |
-
label="μμ€ν
λ©μμ§",
|
229 |
-
lines=5
|
230 |
-
)
|
231 |
-
|
232 |
-
max_tokens = gr.Slider(minimum=1, maximum=4096, value=2048, step=1, label="μ΅λ ν ν° μ")
|
233 |
-
temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature")
|
234 |
-
top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p")
|
235 |
-
top_k = gr.Slider(minimum=0, maximum=100, value=40, step=1, label="Top-k")
|
236 |
-
repeat_penalty = gr.Slider(minimum=0.0, maximum=2.0, value=1.1, step=0.1, label="Repetition penalty")
|
237 |
-
|
238 |
-
with gr.Row():
|
239 |
-
clear_btn = gr.Button("λν μ΄κΈ°ν")
|
240 |
-
|
241 |
-
# Event handlers
|
242 |
-
submit_btn.click(
|
243 |
-
fn=respond,
|
244 |
-
inputs=[msg, chatbot, system_message, max_tokens, temperature, top_p, top_k, repeat_penalty],
|
245 |
-
outputs=[chatbot],
|
246 |
-
queue=True
|
247 |
-
).then(
|
248 |
-
fn=lambda: "",
|
249 |
-
inputs=None,
|
250 |
-
outputs=msg
|
251 |
-
)
|
252 |
-
|
253 |
-
msg.submit(
|
254 |
-
fn=respond,
|
255 |
-
inputs=[msg, chatbot, system_message, max_tokens, temperature, top_p, top_k, repeat_penalty],
|
256 |
-
outputs=[chatbot],
|
257 |
-
queue=True
|
258 |
-
).then(
|
259 |
-
fn=lambda: "",
|
260 |
-
inputs=None,
|
261 |
-
outputs=msg
|
262 |
-
)
|
263 |
-
|
264 |
-
clear_btn.click(lambda: None, None, chatbot, queue=False)
|
265 |
|
266 |
if __name__ == "__main__":
|
267 |
demo.launch()
|
|
|
188 |
</div>
|
189 |
"""
|
190 |
|
191 |
+
demo = gr.Interface(
|
192 |
+
fn=respond,
|
193 |
+
inputs=[
|
194 |
+
gr.Textbox(placeholder="λ©μμ§λ₯Ό μ
λ ₯νμΈμ...", label=""),
|
195 |
+
gr.State([]), # λν κΈ°λ‘μ μ μ₯νλ State
|
196 |
+
gr.Textbox(
|
197 |
+
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.",
|
198 |
+
label="μμ€ν
λ©μμ§",
|
199 |
+
lines=5
|
200 |
+
),
|
201 |
+
gr.Slider(minimum=1, maximum=4096, value=2048, step=1, label="μ΅λ ν ν° μ"),
|
202 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
203 |
+
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p"),
|
204 |
+
gr.Slider(minimum=0, maximum=100, value=40, step=1, label="Top-k"),
|
205 |
+
gr.Slider(minimum=0.0, maximum=2.0, value=1.1, step=0.1, label="Repetition penalty"),
|
206 |
+
],
|
207 |
+
outputs=gr.Chatbot(placeholder=PLACEHOLDER, type="messages"),
|
208 |
+
title="Ginigen Private AI",
|
209 |
+
description="6BIT μμνλ‘ λͺ¨λΈ ν¬κΈ°λ μ€μ΄κ³ μ±λ₯μ μ μ§νλ νλΌμ΄λ²μ μ€μ¬ AI μ루μ
.",
|
210 |
+
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(
|
211 |
body_background_fill_dark="#16141c",
|
212 |
block_background_fill_dark="#16141c",
|
213 |
block_border_width="1px",
|
|
|
219 |
background_fill_secondary_dark="#16141c",
|
220 |
color_accent_soft_dark="transparent",
|
221 |
code_background_fill_dark="#292733",
|
222 |
+
),
|
223 |
+
css=css,
|
224 |
+
examples=[
|
225 |
+
["μλ
νμΈμ, μ λ AIμ κ΄μ¬μ΄ λ§μ΅λλ€. μμνλ 무μμΈκ°μ?"],
|
226 |
+
["λ―Έμ€νΈλ λͺ¨λΈμ νΉμ§μ 무μμΈκ°μ?"],
|
227 |
+
["κΈ΄ 컨ν
μ€νΈ(context)λ₯Ό μ²λ¦¬νλ λ°©λ²μ μ€λͺ
ν΄ μ£ΌμΈμ."]
|
228 |
+
],
|
229 |
+
cache_examples=False
|
230 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
|
232 |
if __name__ == "__main__":
|
233 |
demo.launch()
|