keeperballon commited on
Commit
3ed8771
·
verified ·
1 Parent(s): 153a45e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +87 -114
app.py CHANGED
@@ -195,6 +195,7 @@ custom_css = """
195
  border-radius: 12px;
196
  box-shadow: 0 8px 16px rgba(0,0,0,0.1);
197
  overflow: hidden;
 
198
  }
199
 
200
  .contain {
@@ -226,12 +227,6 @@ h1 {
226
  border-color: #4299e1;
227
  }
228
 
229
- .tabs {
230
- box-shadow: 0 2px 10px rgba(0,0,0,0.05);
231
- border-radius: 8px;
232
- overflow: hidden;
233
- }
234
-
235
  .footer {
236
  text-align: center;
237
  margin-top: 20px;
@@ -264,29 +259,6 @@ h1 {
264
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
265
  }
266
  }
267
-
268
- /* Parameter tooltips */
269
- .parameter-container {
270
- position: relative;
271
- }
272
-
273
- .parameter-info {
274
- display: none;
275
- position: absolute;
276
- background: white;
277
- border: 1px solid #ddd;
278
- padding: 10px;
279
- border-radius: 6px;
280
- box-shadow: 0 2px 5px rgba(0,0,0,0.2);
281
- z-index: 100;
282
- width: 250px;
283
- top: 100%;
284
- left: 10px;
285
- }
286
-
287
- .parameter-container:hover .parameter-info {
288
- display: block;
289
- }
290
  """
291
 
292
  with gr.Blocks(css=custom_css, title=APP_TITLE, theme=gr.themes.Soft()) as demo:
@@ -307,24 +279,24 @@ with gr.Blocks(css=custom_css, title=APP_TITLE, theme=gr.themes.Soft()) as demo:
307
  with gr.Row():
308
  with gr.Column(scale=3):
309
  # Main chat interface
310
- with gr.Box(elem_id="chat-container"):
311
- chatbot = gr.Chatbot(
312
- height=550,
313
- show_copy_button=True,
314
- placeholder="Select a model and begin chatting",
315
- layout="panel"
316
- )
317
-
318
- with gr.Row():
319
- with gr.Column(scale=8):
320
- msg = gr.Textbox(
321
- show_label=False,
322
- placeholder="Type your message here...",
323
- container=False,
324
- scale=8
325
- )
326
- with gr.Column(scale=1, min_width=70):
327
- submit_btn = gr.Button("Send", variant="primary", scale=1)
328
 
329
  with gr.Accordion("Conversation Settings", open=False):
330
  system_message_box = gr.Textbox(
@@ -334,78 +306,79 @@ with gr.Blocks(css=custom_css, title=APP_TITLE, theme=gr.themes.Soft()) as demo:
334
  lines=2
335
  )
336
 
337
- with gr.Tabs(elem_classes="tabs"):
338
- with gr.TabItem("Basic Parameters"):
339
- with gr.Row(elem_classes="parameter-row"):
340
- with gr.Column():
341
- max_tokens_slider = gr.Slider(
342
- minimum=1,
343
- maximum=4096,
344
- value=512,
345
- step=1,
346
- label="Max new tokens"
347
- )
348
- with gr.Column():
349
- temperature_slider = gr.Slider(
350
- minimum=0.1,
351
- maximum=4.0,
352
- value=0.7,
353
- step=0.1,
354
- label="Temperature"
355
- )
356
-
357
- with gr.TabItem("Advanced Parameters"):
358
- with gr.Row(elem_classes="parameter-row"):
359
- with gr.Column():
360
- top_p_slider = gr.Slider(
361
- minimum=0.1,
362
- maximum=1.0,
363
- value=0.95,
364
- step=0.05,
365
- label="Top-P"
366
- )
367
- with gr.Column():
368
- frequency_penalty_slider = gr.Slider(
369
- minimum=-2.0,
370
- maximum=2.0,
371
- value=0.0,
372
- step=0.1,
373
- label="Frequency Penalty"
374
- )
375
-
376
- seed_slider = gr.Slider(
377
- minimum=-1,
378
- maximum=65535,
379
- value=-1,
380
  step=1,
381
- label="Seed (-1 for random)"
 
 
 
 
 
 
 
 
382
  )
383
-
384
- with gr.Column(scale=2):
385
- # Model selection panel
386
- with gr.Box():
387
- gr.HTML("<h3 style='margin-top: 0;'>Model Selection</h3>")
388
 
389
- # Custom model input (this is what the respond function sees)
390
- custom_model_box = gr.Textbox(
391
- value="meta-llama/Llama-3.3-70B-Instruct",
392
- label="Selected Model",
393
- elem_id="custom-model-input"
394
- )
 
 
 
 
 
 
 
 
 
 
 
 
395
 
396
- # Search box
397
- model_search_box = gr.Textbox(
398
- label="Search Models",
399
- placeholder="Type to filter models...",
400
- lines=1
 
401
  )
402
-
403
- # Dynamic model display area
404
- model_display = gr.HTML(update_model_display())
405
-
406
- # Model information display
407
- gr.HTML("<h4>Current Model Info</h4>")
408
- model_info_display = gr.Markdown(get_model_info("meta-llama/Llama-3.3-70B-Instruct"))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
 
410
  # Footer
411
  gr.HTML("""
 
195
  border-radius: 12px;
196
  box-shadow: 0 8px 16px rgba(0,0,0,0.1);
197
  overflow: hidden;
198
+ border: 1px solid #e0e0e0;
199
  }
200
 
201
  .contain {
 
227
  border-color: #4299e1;
228
  }
229
 
 
 
 
 
 
 
230
  .footer {
231
  text-align: center;
232
  margin-top: 20px;
 
259
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
260
  }
261
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  """
263
 
264
  with gr.Blocks(css=custom_css, title=APP_TITLE, theme=gr.themes.Soft()) as demo:
 
279
  with gr.Row():
280
  with gr.Column(scale=3):
281
  # Main chat interface
282
+ chatbot = gr.Chatbot(
283
+ height=550,
284
+ show_copy_button=True,
285
+ placeholder="Select a model and begin chatting",
286
+ layout="panel",
287
+ elem_id="chat-container"
288
+ )
289
+
290
+ with gr.Row():
291
+ with gr.Column(scale=8):
292
+ msg = gr.Textbox(
293
+ show_label=False,
294
+ placeholder="Type your message here...",
295
+ container=False,
296
+ scale=8
297
+ )
298
+ with gr.Column(scale=1, min_width=70):
299
+ submit_btn = gr.Button("Send", variant="primary", scale=1)
300
 
301
  with gr.Accordion("Conversation Settings", open=False):
302
  system_message_box = gr.Textbox(
 
306
  lines=2
307
  )
308
 
309
+ # Use standard Row/Column layout instead of tabs that might not be available
310
+ gr.HTML("<h3>Basic Parameters</h3>")
311
+ with gr.Row():
312
+ with gr.Column():
313
+ max_tokens_slider = gr.Slider(
314
+ minimum=1,
315
+ maximum=4096,
316
+ value=512,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
  step=1,
318
+ label="Max new tokens"
319
+ )
320
+ with gr.Column():
321
+ temperature_slider = gr.Slider(
322
+ minimum=0.1,
323
+ maximum=4.0,
324
+ value=0.7,
325
+ step=0.1,
326
+ label="Temperature"
327
  )
 
 
 
 
 
328
 
329
+ gr.HTML("<h3>Advanced Parameters</h3>")
330
+ with gr.Row():
331
+ with gr.Column():
332
+ top_p_slider = gr.Slider(
333
+ minimum=0.1,
334
+ maximum=1.0,
335
+ value=0.95,
336
+ step=0.05,
337
+ label="Top-P"
338
+ )
339
+ with gr.Column():
340
+ frequency_penalty_slider = gr.Slider(
341
+ minimum=-2.0,
342
+ maximum=2.0,
343
+ value=0.0,
344
+ step=0.1,
345
+ label="Frequency Penalty"
346
+ )
347
 
348
+ seed_slider = gr.Slider(
349
+ minimum=-1,
350
+ maximum=65535,
351
+ value=-1,
352
+ step=1,
353
+ label="Seed (-1 for random)"
354
  )
355
+
356
+ with gr.Column(scale=2):
357
+ # Model selection panel
358
+ gr.HTML("<div style='border: 1px solid #e0e0e0; border-radius: 10px; padding: 15px;'>")
359
+ gr.HTML("<h3 style='margin-top: 0;'>Model Selection</h3>")
360
+
361
+ # Custom model input (this is what the respond function sees)
362
+ custom_model_box = gr.Textbox(
363
+ value="meta-llama/Llama-3.3-70B-Instruct",
364
+ label="Selected Model",
365
+ elem_id="custom-model-input"
366
+ )
367
+
368
+ # Search box
369
+ model_search_box = gr.Textbox(
370
+ label="Search Models",
371
+ placeholder="Type to filter models...",
372
+ lines=1
373
+ )
374
+
375
+ # Dynamic model display area
376
+ model_display = gr.HTML(update_model_display())
377
+
378
+ # Model information display
379
+ gr.HTML("<h4>Current Model Info</h4>")
380
+ model_info_display = gr.Markdown(get_model_info("meta-llama/Llama-3.3-70B-Instruct"))
381
+ gr.HTML("</div>")
382
 
383
  # Footer
384
  gr.HTML("""