TomLii commited on
Commit
4b3dbbd
·
1 Parent(s): f92c7a2

Polish icons, examples, and blue control styling

Browse files
Files changed (1) hide show
  1. app.py +67 -19
app.py CHANGED
@@ -145,7 +145,10 @@ CUSTOM_CSS = """
145
  .icon-grid {
146
  display: grid;
147
  grid-template-columns: repeat(2, minmax(0, 1fr));
148
- gap: 8px;
 
 
 
149
  }
150
 
151
  .icon-link {
@@ -153,14 +156,14 @@ CUSTOM_CSS = """
153
  align-items: center;
154
  justify-content: center;
155
  gap: 8px;
156
- padding: 10px 12px;
157
  border: none;
158
- border-radius: 10px;
159
  text-decoration: none !important;
160
  color: #1d4ed8 !important;
161
  background: #eaf2ff;
162
  font-weight: 600;
163
- font-size: 15px;
164
  }
165
 
166
  .icon-link:hover {
@@ -171,19 +174,20 @@ CUSTOM_CSS = """
171
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%) !important;
172
  color: white !important;
173
  border: none !important;
 
174
  }
175
 
176
  .gradio-container .gr-button-secondary {
177
  background: #ffffff !important;
178
  color: #1d4ed8 !important;
179
- border: none !important;
180
  box-shadow: inset 0 0 0 1px #bfdbfe !important;
181
  }
182
 
183
  .gradio-container .gr-button-stop {
184
  background: #ffffff !important;
185
  color: #1d4ed8 !important;
186
- border: none !important;
187
  box-shadow: inset 0 0 0 1px #bfdbfe !important;
188
  }
189
 
@@ -229,6 +233,38 @@ CUSTOM_CSS = """
229
  margin: 8px 0 2px 0;
230
  }
231
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  .gradio-container .noUi-target {
233
  border: none !important;
234
  box-shadow: none !important;
@@ -585,15 +621,11 @@ with gr.Blocks(
585
 
586
  with gr.Group(elem_classes="section-card"):
587
  gr.HTML('<div class="inline-example-title">Try Examples</div>')
588
- gr.Examples(
589
- examples=[
590
- ["Plan a 2-day food + museum itinerary in Tokyo under $250, with trade-offs."],
591
- ["Find 3 open-source coding agents and compare real strengths/limitations."],
592
- ["Explain whether RAG or fine-tuning is better for a legal QA assistant, and why."],
593
- ],
594
- inputs=question,
595
- label="",
596
- )
597
 
598
  with gr.Group(elem_classes="section-card"):
599
  with gr.Tabs():
@@ -603,7 +635,7 @@ with gr.Blocks(
603
  trace = gr.Code(label="Execution Trace (JSON)", language="json")
604
 
605
  with gr.Column(scale=3, elem_classes="right-stack"):
606
- with gr.Group(elem_classes="section-card"):
607
  gr.Image(
608
  value=LOGO_PATH,
609
  show_label=False,
@@ -614,7 +646,7 @@ with gr.Blocks(
614
  elem_classes="banner-logo-image",
615
  )
616
 
617
- with gr.Group(elem_classes="section-card"):
618
  gr.HTML(
619
  f"""
620
  <div class="icon-grid">
@@ -635,12 +667,13 @@ with gr.Blocks(
635
  allow_custom_value=True,
636
  info="You can type any model id supported by HF Inference API.",
637
  )
638
- max_turns = gr.Slider(label="Max Turns", minimum=2, maximum=20, value=8, step=1)
639
  max_search_results = gr.Slider(
640
  label="Search Results Per Query", minimum=1, maximum=10, value=5, step=1
 
641
  )
642
  temperature = gr.Slider(
643
- label="Temperature", minimum=0.0, maximum=1.5, value=0.4, step=0.1
644
  )
645
 
646
  run_event = run_btn.click(
@@ -648,6 +681,21 @@ with gr.Blocks(
648
  inputs=[question, model, max_turns, max_search_results, temperature],
649
  outputs=[answer, trace],
650
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
651
  stop_btn.click(fn=None, cancels=[run_event])
652
  clear_btn.click(
653
  fn=lambda: ("", "", "{}"),
 
145
  .icon-grid {
146
  display: grid;
147
  grid-template-columns: repeat(2, minmax(0, 1fr));
148
+ gap: 10px;
149
+ width: 100%;
150
+ max-width: 360px;
151
+ margin: 0 auto;
152
  }
153
 
154
  .icon-link {
 
156
  align-items: center;
157
  justify-content: center;
158
  gap: 8px;
159
+ padding: 12px 14px;
160
  border: none;
161
+ border-radius: 12px;
162
  text-decoration: none !important;
163
  color: #1d4ed8 !important;
164
  background: #eaf2ff;
165
  font-weight: 600;
166
+ font-size: 17px;
167
  }
168
 
169
  .icon-link:hover {
 
174
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%) !important;
175
  color: white !important;
176
  border: none !important;
177
+ box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25) !important;
178
  }
179
 
180
  .gradio-container .gr-button-secondary {
181
  background: #ffffff !important;
182
  color: #1d4ed8 !important;
183
+ border: 1px solid #bfdbfe !important;
184
  box-shadow: inset 0 0 0 1px #bfdbfe !important;
185
  }
186
 
187
  .gradio-container .gr-button-stop {
188
  background: #ffffff !important;
189
  color: #1d4ed8 !important;
190
+ border: 1px solid #bfdbfe !important;
191
  box-shadow: inset 0 0 0 1px #bfdbfe !important;
192
  }
193
 
 
233
  margin: 8px 0 2px 0;
234
  }
235
 
236
+ .example-buttons {
237
+ display: grid;
238
+ gap: 10px;
239
+ margin-top: 8px;
240
+ }
241
+
242
+ .example-note {
243
+ color: #3b82f6;
244
+ font-size: 12px;
245
+ margin-top: 2px;
246
+ }
247
+
248
+ .no-frame {
249
+ background: transparent !important;
250
+ border: none !important;
251
+ box-shadow: none !important;
252
+ }
253
+
254
+ .slider-root .noUi-target,
255
+ .slider-root [role="slider"] {
256
+ --track-color: #dbeafe;
257
+ --range-color: #2563eb;
258
+ }
259
+
260
+ .slider-root .noUi-target {
261
+ background: #dbeafe !important;
262
+ }
263
+
264
+ .slider-root .noUi-connect {
265
+ background: #2563eb !important;
266
+ }
267
+
268
  .gradio-container .noUi-target {
269
  border: none !important;
270
  box-shadow: none !important;
 
621
 
622
  with gr.Group(elem_classes="section-card"):
623
  gr.HTML('<div class="inline-example-title">Try Examples</div>')
624
+ gr.HTML('<div class="example-note">Click to auto-fill the chat box</div>')
625
+ with gr.Column(elem_classes="example-buttons"):
626
+ ex1_btn = gr.Button("🌏 Plan a 2-day Tokyo trip under $250 with trade-offs", variant="secondary")
627
+ ex2_btn = gr.Button("🤖 Compare 3 open-source coding agents with pros/cons", variant="secondary")
628
+ ex3_btn = gr.Button("⚖️ RAG vs fine-tuning for legal QA: which and why?", variant="secondary")
 
 
 
 
629
 
630
  with gr.Group(elem_classes="section-card"):
631
  with gr.Tabs():
 
635
  trace = gr.Code(label="Execution Trace (JSON)", language="json")
636
 
637
  with gr.Column(scale=3, elem_classes="right-stack"):
638
+ with gr.Group(elem_classes=["section-card", "no-frame"]):
639
  gr.Image(
640
  value=LOGO_PATH,
641
  show_label=False,
 
646
  elem_classes="banner-logo-image",
647
  )
648
 
649
+ with gr.Group(elem_classes=["section-card", "no-frame"]):
650
  gr.HTML(
651
  f"""
652
  <div class="icon-grid">
 
667
  allow_custom_value=True,
668
  info="You can type any model id supported by HF Inference API.",
669
  )
670
+ max_turns = gr.Slider(label="Max Turns", minimum=2, maximum=20, value=8, step=1, elem_classes="slider-root")
671
  max_search_results = gr.Slider(
672
  label="Search Results Per Query", minimum=1, maximum=10, value=5, step=1
673
+ , elem_classes="slider-root"
674
  )
675
  temperature = gr.Slider(
676
+ label="Temperature", minimum=0.0, maximum=1.5, value=0.4, step=0.1, elem_classes="slider-root"
677
  )
678
 
679
  run_event = run_btn.click(
 
681
  inputs=[question, model, max_turns, max_search_results, temperature],
682
  outputs=[answer, trace],
683
  )
684
+ ex1_btn.click(
685
+ fn=lambda: "Plan a 2-day food + museum itinerary in Tokyo under $250, with trade-offs.",
686
+ inputs=[],
687
+ outputs=[question],
688
+ )
689
+ ex2_btn.click(
690
+ fn=lambda: "Find 3 open-source coding agents and compare real strengths/limitations.",
691
+ inputs=[],
692
+ outputs=[question],
693
+ )
694
+ ex3_btn.click(
695
+ fn=lambda: "Explain whether RAG or fine-tuning is better for a legal QA assistant, and why.",
696
+ inputs=[],
697
+ outputs=[question],
698
+ )
699
  stop_btn.click(fn=None, cancels=[run_event])
700
  clear_btn.click(
701
  fn=lambda: ("", "", "{}"),