Haris-Subrata commited on
Commit
1c7ab87
·
verified ·
1 Parent(s): 621c0b1

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. app.py +1 -0
  2. neurobait-mark.png +0 -0
  3. ui.py +64 -27
app.py CHANGED
@@ -202,5 +202,6 @@ if __name__ == "__main__":
202
  theme=THEME,
203
  js=JS,
204
  i18n=I18N,
 
205
  allowed_paths=["."],
206
  )
 
202
  theme=THEME,
203
  js=JS,
204
  i18n=I18N,
205
+ footer_links=[],
206
  allowed_paths=["."],
207
  )
neurobait-mark.png ADDED
ui.py CHANGED
@@ -20,6 +20,9 @@ UX notes for ADHD users:
20
 
21
  from __future__ import annotations
22
 
 
 
 
23
  import gradio as gr
24
 
25
  MOODS = ["Calm", "Tired", "Anxious", "Focused"]
@@ -27,7 +30,7 @@ MOODS = ["Calm", "Tired", "Anxious", "Focused"]
27
  THEME = gr.themes.Soft(primary_hue="teal", neutral_hue="slate")
28
 
29
  TITLE = ""
30
- LOGO_PATH = "neurobait-logo.jpg"
31
 
32
  DESCRIPTION = (
33
  "A warm space and a gentle boost for your everyday. "
@@ -47,6 +50,27 @@ I18N = gr.I18n(
47
  id=I18N_FOOTER,
48
  )
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  PLACEHOLDER = "What's on your mind? No need to be tidy."
51
 
52
  EXAMPLES = [
@@ -99,26 +123,29 @@ h1 { letter-spacing: -0.5px; font-weight: 800; }
99
 
100
  .nb-header {
101
  display: flex;
102
- justify-content: center;
103
- padding: 1.5rem 0 0.75rem;
 
 
104
  }
105
- .nb-logo,
106
- #neurobait-logo {
107
- display: block;
108
- width: min(360px, 76vw);
109
- max-width: 360px;
110
- height: auto;
111
- margin: 0 auto;
112
- border-radius: 0;
113
  }
114
- #neurobait-logo,
115
- #neurobait-logo > div {
116
- background: transparent !important;
117
- border: 0 !important;
118
- box-shadow: none !important;
 
119
  }
120
- #neurobait-logo img {
121
- object-fit: contain !important;
 
 
 
122
  }
123
 
124
  /* user bubble gets the brand accent, assistant stays flat/quiet */
@@ -204,6 +231,23 @@ button.primary, .submit-button, [variant="primary"] {
204
  margin-top: 1rem;
205
  border-top: 1px solid var(--sand);
206
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  """
208
 
209
  JS = """
@@ -275,15 +319,7 @@ def build_demo(respond_fn):
275
  respond_fn(message: str, history: list[dict], mood: str) -> str | generator[str]
276
  """
277
  with gr.Blocks(fill_height=True) as demo:
278
- with gr.Row(elem_classes=["nb-header"]):
279
- gr.Image(
280
- value=LOGO_PATH,
281
- show_label=False,
282
- interactive=False,
283
- container=False,
284
- height=148,
285
- elem_id="neurobait-logo",
286
- )
287
  mood = gr.Radio(
288
  MOODS,
289
  value="Calm",
@@ -311,4 +347,5 @@ def build_demo(respond_fn):
311
  fill_height=True,
312
  autoscroll=True,
313
  )
 
314
  return demo
 
20
 
21
  from __future__ import annotations
22
 
23
+ import base64
24
+ from pathlib import Path
25
+
26
  import gradio as gr
27
 
28
  MOODS = ["Calm", "Tired", "Anxious", "Focused"]
 
30
  THEME = gr.themes.Soft(primary_hue="teal", neutral_hue="slate")
31
 
32
  TITLE = ""
33
+ MARK_PATH = Path(__file__).with_name("neurobait-mark.png")
34
 
35
  DESCRIPTION = (
36
  "A warm space and a gentle boost for your everyday. "
 
50
  id=I18N_FOOTER,
51
  )
52
 
53
+ MARK_SRC = f"data:image/png;base64,{base64.b64encode(MARK_PATH.read_bytes()).decode('ascii')}"
54
+ HEADER_HTML = f"""
55
+ <header class="nb-header">
56
+ <img src="{MARK_SRC}" alt="" class="nb-mark" />
57
+ <div>
58
+ <div class="nb-wordmark">NeuroBait</div>
59
+ <div class="nb-kicker">task initiation companion</div>
60
+ </div>
61
+ </header>
62
+ """
63
+
64
+ FOOTER_HTML = """
65
+ <div class="nb-footer-links">
66
+ <a href="/?view=api">Use via API</a>
67
+ <span>·</span>
68
+ <a href="https://gradio.app" target="_blank" rel="noreferrer">Built with Gradio</a>
69
+ <span>·</span>
70
+ <span>Settings</span>
71
+ </div>
72
+ """
73
+
74
  PLACEHOLDER = "What's on your mind? No need to be tidy."
75
 
76
  EXAMPLES = [
 
123
 
124
  .nb-header {
125
  display: flex;
126
+ align-items: center;
127
+ justify-content: flex-start;
128
+ gap: 12px;
129
+ padding: 1rem 0 0.4rem;
130
  }
131
+ .nb-mark {
132
+ width: 42px;
133
+ height: 42px;
134
+ object-fit: contain;
135
+ flex: 0 0 auto;
 
 
 
136
  }
137
+ .nb-wordmark {
138
+ font-size: 1.24rem;
139
+ line-height: 1.05;
140
+ font-weight: 780;
141
+ letter-spacing: 0;
142
+ color: var(--charcoal);
143
  }
144
+ .nb-kicker {
145
+ margin-top: 3px;
146
+ color: var(--stone);
147
+ font-size: 0.78rem;
148
+ line-height: 1.2;
149
  }
150
 
151
  /* user bubble gets the brand accent, assistant stays flat/quiet */
 
231
  margin-top: 1rem;
232
  border-top: 1px solid var(--sand);
233
  }
234
+ .nb-footer-links {
235
+ display: flex;
236
+ align-items: center;
237
+ justify-content: center;
238
+ gap: 9px;
239
+ color: var(--stone);
240
+ font-size: 0.8rem;
241
+ margin: 1.75rem 0 0.25rem;
242
+ }
243
+ .nb-footer-links a,
244
+ .nb-footer-links span {
245
+ color: var(--stone) !important;
246
+ text-decoration: none !important;
247
+ }
248
+ .nb-footer-links a:hover {
249
+ color: var(--charcoal) !important;
250
+ }
251
  """
252
 
253
  JS = """
 
319
  respond_fn(message: str, history: list[dict], mood: str) -> str | generator[str]
320
  """
321
  with gr.Blocks(fill_height=True) as demo:
322
+ gr.HTML(HEADER_HTML)
 
 
 
 
 
 
 
 
323
  mood = gr.Radio(
324
  MOODS,
325
  value="Calm",
 
347
  fill_height=True,
348
  autoscroll=True,
349
  )
350
+ gr.HTML(FOOTER_HTML)
351
  return demo