ginipick commited on
Commit
678d443
Β·
verified Β·
1 Parent(s): 6c3b25d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -63
app.py CHANGED
@@ -188,7 +188,26 @@ PLACEHOLDER = """
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,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
- ), css=css) as demo:
204
-
205
- gr.Markdown("# Ginigen Private AI")
206
- gr.Markdown("6BIT μ–‘μžν™”λ‘œ λͺ¨λΈ ν¬κΈ°λŠ” 쀄이고 μ„±λŠ₯은 μœ μ§€ν•˜λŠ” ν”„λΌμ΄λ²„μ‹œ 쀑심 AI μ†”λ£¨μ…˜.")
207
-
208
- with gr.Row():
209
- with gr.Column(scale=3):
210
- chatbot = gr.Chatbot(
211
- scale=1,
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()