TomLii commited on
Commit
f656413
·
1 Parent(s): b716750

Adjust typography and controls layout

Browse files
Files changed (1) hide show
  1. app.py +24 -22
app.py CHANGED
@@ -48,8 +48,15 @@ TOOL_RESPONSE_TEMPLATE = """<tool_response>
48
  </tool_response>"""
49
 
50
  CUSTOM_CSS = """
 
 
51
  .gradio-container {
52
  max-width: 1200px !important;
 
 
 
 
 
53
  }
54
 
55
  .banner-card {
@@ -333,6 +340,7 @@ with gr.Blocks(
333
  )
334
  with gr.Row():
335
  run_btn = gr.Button("Run Research", variant="primary", size="lg")
 
336
  clear_btn = gr.Button("Clear", variant="secondary", size="lg")
337
  gr.Examples(
338
  examples=[
@@ -346,27 +354,20 @@ with gr.Blocks(
346
 
347
  with gr.Column(scale=3):
348
  with gr.Group(elem_classes="section-card"):
349
- with gr.Accordion("Model & Runtime Settings", open=False):
350
- model = gr.Dropdown(
351
- label="Model",
352
- choices=DEFAULT_FREE_MODELS,
353
- value=DEFAULT_MODEL if DEFAULT_MODEL in DEFAULT_FREE_MODELS else DEFAULT_FREE_MODELS[0],
354
- allow_custom_value=True,
355
- info="You can type any model id supported by HF Inference API.",
356
- )
357
- max_turns = gr.Slider(label="Max Turns", minimum=2, maximum=20, value=8, step=1)
358
- max_search_results = gr.Slider(
359
- label="Search Results Per Query", minimum=1, maximum=10, value=5, step=1
360
- )
361
- temperature = gr.Slider(
362
- label="Temperature", minimum=0.0, maximum=1.5, value=0.4, step=0.1
363
- )
364
- gr.Markdown(
365
- """
366
- **Tips**
367
- - Add `HF_TOKEN` in Space Secrets for stable access.
368
- - Start with fewer turns for speed, then increase for harder tasks.
369
- """
370
  )
371
 
372
  with gr.Group(elem_classes="section-card"):
@@ -376,11 +377,12 @@ with gr.Blocks(
376
  with gr.TabItem("Execution Trace (JSON)"):
377
  trace = gr.Code(label="Execution Trace (JSON)", language="json")
378
 
379
- run_btn.click(
380
  fn=run_ui,
381
  inputs=[question, model, max_turns, max_search_results, temperature],
382
  outputs=[answer, trace],
383
  )
 
384
  clear_btn.click(
385
  fn=lambda: ("", "", "{}"),
386
  inputs=[],
 
48
  </tool_response>"""
49
 
50
  CUSTOM_CSS = """
51
+ @import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&display=swap');
52
+
53
  .gradio-container {
54
  max-width: 1200px !important;
55
+ font-family: 'Manrope', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
56
+ }
57
+
58
+ .gradio-container * {
59
+ font-family: inherit !important;
60
  }
61
 
62
  .banner-card {
 
340
  )
341
  with gr.Row():
342
  run_btn = gr.Button("Run Research", variant="primary", size="lg")
343
+ stop_btn = gr.Button("Stop", variant="stop", size="lg")
344
  clear_btn = gr.Button("Clear", variant="secondary", size="lg")
345
  gr.Examples(
346
  examples=[
 
354
 
355
  with gr.Column(scale=3):
356
  with gr.Group(elem_classes="section-card"):
357
+ gr.HTML('<div class="section-title">Model & Runtime Settings</div>')
358
+ model = gr.Dropdown(
359
+ label="Model",
360
+ choices=DEFAULT_FREE_MODELS,
361
+ value=DEFAULT_MODEL if DEFAULT_MODEL in DEFAULT_FREE_MODELS else DEFAULT_FREE_MODELS[0],
362
+ allow_custom_value=True,
363
+ info="You can type any model id supported by HF Inference API.",
364
+ )
365
+ max_turns = gr.Slider(label="Max Turns", minimum=2, maximum=20, value=8, step=1)
366
+ max_search_results = gr.Slider(
367
+ label="Search Results Per Query", minimum=1, maximum=10, value=5, step=1
368
+ )
369
+ temperature = gr.Slider(
370
+ label="Temperature", minimum=0.0, maximum=1.5, value=0.4, step=0.1
 
 
 
 
 
 
 
371
  )
372
 
373
  with gr.Group(elem_classes="section-card"):
 
377
  with gr.TabItem("Execution Trace (JSON)"):
378
  trace = gr.Code(label="Execution Trace (JSON)", language="json")
379
 
380
+ run_event = run_btn.click(
381
  fn=run_ui,
382
  inputs=[question, model, max_turns, max_search_results, temperature],
383
  outputs=[answer, trace],
384
  )
385
+ stop_btn.click(fn=None, cancels=[run_event])
386
  clear_btn.click(
387
  fn=lambda: ("", "", "{}"),
388
  inputs=[],