ginipick commited on
Commit
2656840
Β·
verified Β·
1 Parent(s): 3f09ea8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +81 -53
app.py CHANGED
@@ -184,7 +184,6 @@ PLACEHOLDER = """
184
  <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;">
185
  Private BitSix Mistral Small 3.1 24B Instruct
186
  </span>
187
-
188
  </div>
189
  <div style="display: flex; justify-content: flex-end; align-items: center;">
190
  <a href="https://discord.gg/openfreeai" target="_blank" rel="noreferrer" style="padding: .5rem;">
@@ -193,49 +192,13 @@ PLACEHOLDER = """
193
  <path d="M26.0015 6.9529C24.0021 6.03845 21.8787 5.37198 19.6623 5C19.3833 5.48048 19.0733 6.13144 18.8563 6.64292C16.4989 6.30193 14.1585 6.30193 11.8336 6.64292C11.6166 6.13144 11.2911 5.48048 11.0276 5C8.79575 5.37198 6.67235 6.03845 4.6869 6.9529C0.672601 12.8736 -0.41235 18.6548 0.130124 24.3585C2.79599 26.2959 5.36889 27.4739 7.89682 28.2489C8.51679 27.4119 9.07477 26.5129 9.55525 25.5675C8.64079 25.2265 7.77283 24.808 6.93587 24.312C7.15286 24.1571 7.36986 23.9866 7.57135 23.8161C12.6241 26.1255 18.0969 26.1255 23.0876 23.8161C23.3046 23.9866 23.5061 24.1571 23.7231 24.312C22.8861 24.808 22.0182 25.2265 21.1037 25.5675C21.5842 26.5129 22.1422 27.4119 22.7621 28.2489C25.2885 27.4739 27.8769 26.2959 30.5288 24.3585C31.1952 17.7559 29.4733 12.0212 26.0015 6.9529ZM10.2527 20.8402C8.73376 20.8402 7.49382 19.4608 7.49382 17.7714C7.49382 16.082 8.70276 14.7025 10.2527 14.7025C11.7871 14.7025 13.0425 16.082 13.0115 17.7714C13.0115 19.4608 11.7871 20.8402 10.2527 20.8402ZM20.4373 20.8402C18.9183 20.8402 17.6768 19.4608 17.6768 17.7714C17.6768 16.082 18.8873 14.7025 20.4373 14.7025C21.9717 14.7025 23.2271 16.082 23.1961 17.7714C23.1961 19.4608 21.9872 20.8402 20.4373 20.8402Z"></path>
194
  </svg>
195
  </a>
196
- </a>
197
  </div>
198
  </div>
199
  </div>
200
  </div>
201
  """
202
 
203
- demo = gr.ChatInterface(
204
- respond,
205
- additional_inputs=[
206
- gr.Dropdown([
207
- MISTRAL_MODEL_NAME,
208
- LLAMA_MODEL_NAME
209
- ],
210
- value=MISTRAL_MODEL_NAME,
211
- label="Model"
212
- ),
213
- gr.Textbox(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.", label="System message"),
214
- gr.Slider(minimum=1, maximum=4096, value=2048, step=1, label="Max tokens"),
215
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
216
- gr.Slider(
217
- minimum=0.1,
218
- maximum=1.0,
219
- value=0.95,
220
- step=0.05,
221
- label="Top-p",
222
- ),
223
- gr.Slider(
224
- minimum=0,
225
- maximum=100,
226
- value=40,
227
- step=1,
228
- label="Top-k",
229
- ),
230
- gr.Slider(
231
- minimum=0.0,
232
- maximum=2.0,
233
- value=1.1,
234
- step=0.1,
235
- label="Repetition penalty",
236
- ),
237
- ],
238
- 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(
239
  body_background_fill_dark="#16141c",
240
  block_background_fill_dark="#16141c",
241
  block_border_width="1px",
@@ -247,22 +210,87 @@ demo = gr.ChatInterface(
247
  background_fill_secondary_dark="#16141c",
248
  color_accent_soft_dark="transparent",
249
  code_background_fill_dark="#292733",
250
- ),
251
- css=css,
252
- retry_btn="Retry",
253
- undo_btn="Undo",
254
- clear_btn="Clear",
255
- submit_btn="Send",
256
- description="ginigen/Private-BitSix-Mistral-Small-3.1-24B-Instruct-2503",
257
-
258
- chatbot=gr.Chatbot(
259
- scale=1,
260
- placeholder=PLACEHOLDER,
261
- show_copy_button=True
262
- # Remove the 'likeable' parameter
263
- )
 
 
 
 
 
 
 
264
 
265
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
 
267
  if __name__ == "__main__":
268
  demo.launch()
 
184
  <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;">
185
  Private BitSix Mistral Small 3.1 24B Instruct
186
  </span>
 
187
  </div>
188
  <div style="display: flex; justify-content: flex-end; align-items: center;">
189
  <a href="https://discord.gg/openfreeai" target="_blank" rel="noreferrer" style="padding: .5rem;">
 
192
  <path d="M26.0015 6.9529C24.0021 6.03845 21.8787 5.37198 19.6623 5C19.3833 5.48048 19.0733 6.13144 18.8563 6.64292C16.4989 6.30193 14.1585 6.30193 11.8336 6.64292C11.6166 6.13144 11.2911 5.48048 11.0276 5C8.79575 5.37198 6.67235 6.03845 4.6869 6.9529C0.672601 12.8736 -0.41235 18.6548 0.130124 24.3585C2.79599 26.2959 5.36889 27.4739 7.89682 28.2489C8.51679 27.4119 9.07477 26.5129 9.55525 25.5675C8.64079 25.2265 7.77283 24.808 6.93587 24.312C7.15286 24.1571 7.36986 23.9866 7.57135 23.8161C12.6241 26.1255 18.0969 26.1255 23.0876 23.8161C23.3046 23.9866 23.5061 24.1571 23.7231 24.312C22.8861 24.808 22.0182 25.2265 21.1037 25.5675C21.5842 26.5129 22.1422 27.4119 22.7621 28.2489C25.2885 27.4739 27.8769 26.2959 30.5288 24.3585C31.1952 17.7559 29.4733 12.0212 26.0015 6.9529ZM10.2527 20.8402C8.73376 20.8402 7.49382 19.4608 7.49382 17.7714C7.49382 16.082 8.70276 14.7025 10.2527 14.7025C11.7871 14.7025 13.0425 16.082 13.0115 17.7714C13.0115 19.4608 11.7871 20.8402 10.2527 20.8402ZM20.4373 20.8402C18.9183 20.8402 17.6768 19.4608 17.6768 17.7714C17.6768 16.082 18.8873 14.7025 20.4373 14.7025C21.9717 14.7025 23.2271 16.082 23.1961 17.7714C23.1961 19.4608 21.9872 20.8402 20.4373 20.8402Z"></path>
193
  </svg>
194
  </a>
 
195
  </div>
196
  </div>
197
  </div>
198
  </div>
199
  """
200
 
201
+ 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(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  body_background_fill_dark="#16141c",
203
  block_background_fill_dark="#16141c",
204
  block_border_width="1px",
 
210
  background_fill_secondary_dark="#16141c",
211
  color_accent_soft_dark="transparent",
212
  code_background_fill_dark="#292733",
213
+ ), css=css) as demo:
214
+
215
+ gr.Markdown("# Ginigen Private AI")
216
+ gr.Markdown("6BIT μ–‘μžν™”λ‘œ λͺ¨λΈ ν¬κΈ°λŠ” 쀄이고 μ„±λŠ₯은 μœ μ§€ν•˜λŠ” ν”„λΌμ΄λ²„μ‹œ 쀑심 AI μ†”λ£¨μ…˜.")
217
+
218
+ with gr.Row():
219
+ with gr.Column(scale=3):
220
+ chatbot = gr.Chatbot(
221
+ scale=1,
222
+ placeholder=PLACEHOLDER,
223
+ show_copy_button=True,
224
+ type="messages" # Deprecation κ²½κ³  λ°©μ§€
225
+ )
226
+
227
+ with gr.Row():
228
+ msg = gr.Textbox(
229
+ show_label=False,
230
+ placeholder="λ©”μ‹œμ§€λ₯Ό μž…λ ₯ν•˜μ„Έμš”...",
231
+ container=False
232
+ )
233
+ submit_btn = gr.Button("전솑", variant="primary")
234
 
235
+ with gr.Column(scale=1):
236
+ model_choice = gr.Dropdown(
237
+ [MISTRAL_MODEL_NAME, LLAMA_MODEL_NAME],
238
+ value=MISTRAL_MODEL_NAME,
239
+ label="λͺ¨λΈ"
240
+ )
241
+
242
+ system_message = gr.Textbox(
243
+ 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.",
244
+ label="μ‹œμŠ€ν…œ λ©”μ‹œμ§€",
245
+ lines=5
246
+ )
247
+
248
+ max_tokens = gr.Slider(minimum=1, maximum=4096, value=2048, step=1, label="μ΅œλŒ€ 토큰 수")
249
+ temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature")
250
+ top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p")
251
+ top_k = gr.Slider(minimum=0, maximum=100, value=40, step=1, label="Top-k")
252
+ repeat_penalty = gr.Slider(minimum=0.0, maximum=2.0, value=1.1, step=0.1, label="Repetition penalty")
253
+
254
+ with gr.Row():
255
+ clear_btn = gr.Button("λŒ€ν™” μ΄ˆκΈ°ν™”")
256
+ retry_btn = gr.Button("λ‹€μ‹œ μ‹œλ„")
257
+
258
+ # Event handlers
259
+ submit_btn.click(
260
+ fn=respond,
261
+ inputs=[msg, chatbot, model_choice, system_message, max_tokens, temperature, top_p, top_k, repeat_penalty],
262
+ outputs=[chatbot],
263
+ queue=True
264
+ ).then(
265
+ fn=lambda: "",
266
+ inputs=None,
267
+ outputs=msg
268
+ )
269
+
270
+ msg.submit(
271
+ fn=respond,
272
+ inputs=[msg, chatbot, model_choice, system_message, max_tokens, temperature, top_p, top_k, repeat_penalty],
273
+ outputs=[chatbot],
274
+ queue=True
275
+ ).then(
276
+ fn=lambda: "",
277
+ inputs=None,
278
+ outputs=msg
279
+ )
280
+
281
+ clear_btn.click(lambda: None, None, chatbot, queue=False)
282
+
283
+ retry_btn.click(
284
+ fn=lambda x: x[:-1],
285
+ inputs=[chatbot],
286
+ outputs=[chatbot],
287
+ queue=False
288
+ ).then(
289
+ fn=respond,
290
+ inputs=[chatbot[-1][0] if len(chatbot) > 0 else "", chatbot, model_choice, system_message, max_tokens, temperature, top_p, top_k, repeat_penalty],
291
+ outputs=[chatbot],
292
+ queue=True
293
+ )
294
 
295
  if __name__ == "__main__":
296
  demo.launch()