Tonic commited on
Commit
6d82e2e
·
1 Parent(s): b645ccb

adds interface correctly with layout html

Browse files
Files changed (1) hide show
  1. app.py +22 -12
app.py CHANGED
@@ -263,21 +263,25 @@ APP_CSS = """
263
  .gradio-container {min-height: 100vh;}
264
  """
265
 
266
- with gr.Blocks(theme=gr.themes.Soft(), css=APP_CSS) as demo:
267
- gr.Markdown(TITLE_MD)
268
- # Informational sections above the chatbot
269
- with gr.Row():
270
- with gr.Column(scale=3):
271
- gr.Markdown(DESCRIPTION_MD)
272
- with gr.Column(scale=2):
273
- gr.Markdown(JOIN_US_MD)
 
 
 
274
 
275
- # Large chatbot (fills viewport minus header via CSS)
276
- large_chatbot = gr.Chatbot(label="Chatbot", elem_id="main_chatbot")
277
 
278
- gr.ChatInterface(
279
  fn=generate_response,
280
- chatbot=large_chatbot,
 
 
281
  additional_inputs=[
282
  gr.Slider(label="Max new tokens", minimum=64, maximum=4096, step=1, value=2048),
283
  gr.Textbox(
@@ -304,6 +308,10 @@ with gr.Blocks(theme=gr.themes.Soft(), css=APP_CSS) as demo:
304
  value=DEFAULT_REASONING_EFFORT,
305
  interactive=True,
306
  ),
 
 
 
 
307
  ],
308
  additional_inputs_accordion="Additional Parameters",
309
  examples=[
@@ -323,6 +331,8 @@ with gr.Blocks(theme=gr.themes.Soft(), css=APP_CSS) as demo:
323
  ),
324
  stop_btn="Stop Generation",
325
  multimodal=False,
 
 
326
  )
327
 
328
  if __name__ == "__main__":
 
263
  .gradio-container {min-height: 100vh;}
264
  """
265
 
266
+ # Build a single ChatInterface (no outer Blocks) to avoid layout conflicts
267
+ description_html = f"""
268
+ <div style=\"display:flex; gap: 16px; align-items:flex-start; flex-wrap: wrap\">
269
+ <div style=\"flex: 1 1 60%; min-width: 300px;\">
270
+ {DESCRIPTION_MD}
271
+ </div>
272
+ <div style=\"flex: 1 1 35%; min-width: 260px;\">
273
+ {JOIN_US_MD}
274
+ </div>
275
+ </div>
276
+ """
277
 
278
+ custom_chatbot = gr.Chatbot(label="Chatbot", elem_id="main_chatbot", latex_delimiters=LATEX_DELIMS)
 
279
 
280
+ demo = gr.ChatInterface(
281
  fn=generate_response,
282
+ chatbot=custom_chatbot,
283
+ title=f"🙋🏻‍♂️ Welcome to 🌟Tonic's ⚕️{MODEL_NAME} Demo !",
284
+ description=description_html,
285
  additional_inputs=[
286
  gr.Slider(label="Max new tokens", minimum=64, maximum=4096, step=1, value=2048),
287
  gr.Textbox(
 
308
  value=DEFAULT_REASONING_EFFORT,
309
  interactive=True,
310
  ),
311
+ gr.Slider(label="Temperature", minimum=0.1, maximum=2.0, step=0.1, value=0.7),
312
+ gr.Slider(label="Top-p", minimum=0.05, maximum=1.0, step=0.05, value=0.9),
313
+ gr.Slider(label="Top-k", minimum=1, maximum=100, step=1, value=50),
314
+ gr.Slider(label="Repetition Penalty", minimum=1.0, maximum=2.0, step=0.05, value=1.0),
315
  ],
316
  additional_inputs_accordion="Additional Parameters",
317
  examples=[
 
331
  ),
332
  stop_btn="Stop Generation",
333
  multimodal=False,
334
+ theme=gr.themes.Soft(),
335
+ css=APP_CSS,
336
  )
337
 
338
  if __name__ == "__main__":