OpceanAI commited on
Commit
32d1c49
·
verified ·
1 Parent(s): 44db14a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +239 -92
app.py CHANGED
@@ -1,140 +1,269 @@
1
  import gradio as gr
2
 
3
  custom_css = """
4
- @import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Mono:wght@300;400;500&display=swap');
5
 
6
  :root {
7
- --ink: #0a0a0a;
8
- --paper: #f5f2ed;
9
- --accent: #c8a97e;
10
- --muted: #8a8278;
11
- --border: #d4cfc8;
12
- --surface: #ede9e2;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  }
14
 
15
- * {
16
- font-family: 'DM Mono', monospace;
17
  box-sizing: border-box;
18
  }
19
 
20
- body, .gradio-container {
21
- background-color: var(--paper) !important;
22
- color: var(--ink) !important;
 
 
 
 
 
 
 
23
  }
24
 
25
- .gradio-container {
26
- max-width: 100% !important;
 
 
 
 
27
  }
28
 
29
- .sidebar {
30
- background-color: var(--ink) !important;
31
- border-right: none !important;
32
- padding: 2.5rem 2rem !important;
33
  }
34
 
35
- .sidebar * {
36
- color: var(--paper) !important;
 
 
 
 
 
 
37
  }
38
 
39
- .sidebar h1 {
40
- font-family: 'DM Serif Display', serif !important;
41
- font-size: 1.6rem !important;
42
- letter-spacing: -0.02em !important;
43
- line-height: 1.2 !important;
44
- margin-bottom: 1.5rem !important;
45
- color: var(--accent) !important;
46
- border-bottom: 1px solid #2a2a2a !important;
47
- padding-bottom: 1rem !important;
48
  }
49
 
50
- .sidebar p {
51
- font-size: 0.72rem !important;
52
- line-height: 1.7 !important;
53
- color: #9a9490 !important;
54
- letter-spacing: 0.02em !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  }
56
 
57
- button.lg {
58
- background-color: transparent !important;
59
- color: var(--accent) !important;
60
- border: 1px solid var(--accent) !important;
61
- border-radius: 0 !important;
62
- font-family: 'DM Mono', monospace !important;
63
- font-size: 0.7rem !important;
64
- letter-spacing: 0.12em !important;
65
- text-transform: uppercase !important;
66
- padding: 0.7rem 1.4rem !important;
67
- transition: all 0.2s ease !important;
68
- margin-top: 1.5rem !important;
69
- width: 100% !important;
70
  }
71
 
72
- button.lg:hover {
73
- background-color: var(--accent) !important;
74
- color: var(--ink) !important;
75
  }
76
 
77
- .chatbot {
78
- background-color: var(--paper) !important;
 
79
  border: 1px solid var(--border) !important;
80
- border-radius: 0 !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  }
82
 
83
- .message.user {
84
- background-color: var(--surface) !important;
85
- border-radius: 0 !important;
86
- border-left: 3px solid var(--accent) !important;
 
 
 
87
  }
88
 
89
- .message.bot {
90
- background-color: transparent !important;
91
- border-radius: 0 !important;
92
- border-left: 3px solid var(--border) !important;
 
 
 
 
 
 
 
93
  }
94
 
95
- textarea, input[type="text"] {
96
- background-color: var(--paper) !important;
 
 
97
  border: 1px solid var(--border) !important;
98
- border-radius: 0 !important;
99
- color: var(--ink) !important;
100
- font-family: 'DM Mono', monospace !important;
101
- font-size: 0.8rem !important;
 
 
 
 
 
102
  }
103
 
104
- textarea:focus, input[type="text"]:focus {
105
- border-color: var(--accent) !important;
106
- box-shadow: none !important;
 
107
  outline: none !important;
 
 
 
 
 
 
108
  }
109
 
110
- .submit-btn, button[variant="primary"] {
111
- background-color: var(--ink) !important;
112
- color: var(--paper) !important;
113
- border-radius: 0 !important;
114
  border: none !important;
115
- font-family: 'DM Mono', monospace !important;
116
- font-size: 0.7rem !important;
117
- letter-spacing: 0.1em !important;
118
- text-transform: uppercase !important;
119
- transition: background-color 0.2s ease !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  }
121
 
122
- .submit-btn:hover, button[variant="primary"]:hover {
123
- background-color: var(--accent) !important;
124
  }
125
 
126
- label span {
127
- font-size: 0.65rem !important;
128
- letter-spacing: 0.1em !important;
 
 
 
 
129
  text-transform: uppercase !important;
130
- color: var(--muted) !important;
131
  }
132
 
133
- .block {
134
- border-radius: 0 !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  }
136
 
137
- footer {
 
 
138
  display: none !important;
139
  }
140
  """
@@ -144,15 +273,33 @@ with gr.Blocks(
144
  css=custom_css,
145
  title="Yuuki-RxG",
146
  theme=gr.themes.Base(
147
- primary_hue="stone",
148
- neutral_hue="stone",
149
- font=gr.themes.GoogleFont("DM Mono"),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  )
151
  ) as demo:
152
  with gr.Sidebar():
153
  gr.Markdown("# Yuuki-RxG")
154
  gr.Markdown(
155
- "Modelo servido via **featherless-ai**. "
156
  "Inicia sesión con tu cuenta de Hugging Face para acceder a la inferencia."
157
  )
158
  button = gr.LoginButton("Iniciar sesión")
 
1
  import gradio as gr
2
 
3
  custom_css = """
4
+ @import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600&family=Geist+Mono:wght@300;400&display=swap');
5
 
6
  :root {
7
+ --bg: #ffffff;
8
+ --bg-subtle: #fafafa;
9
+ --bg-muted: #f4f4f5;
10
+ --border: #e4e4e7;
11
+ --border-soft: #f0f0f1;
12
+ --text: #09090b;
13
+ --text-muted: #71717a;
14
+ --text-faint: #a1a1aa;
15
+ --accent: #18181b;
16
+ --accent-fg: #ffffff;
17
+ --user-bubble: #18181b;
18
+ --user-fg: #ffffff;
19
+ --bot-bubble: #f4f4f5;
20
+ --bot-fg: #09090b;
21
+ --sidebar-bg: #09090b;
22
+ --sidebar-fg: #fafafa;
23
+ --sidebar-mut: #71717a;
24
+ --radius: 12px;
25
+ --radius-sm: 8px;
26
+ --font: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
27
+ --mono: 'Geist Mono', 'Fira Code', monospace;
28
  }
29
 
30
+ *, *::before, *::after {
 
31
  box-sizing: border-box;
32
  }
33
 
34
+ body,
35
+ .gradio-container,
36
+ .gradio-container > .main,
37
+ .gradio-container > .main > .wrap {
38
+ background: var(--bg) !important;
39
+ color: var(--text) !important;
40
+ font-family: var(--font) !important;
41
+ font-size: 14px !important;
42
+ line-height: 1.6 !important;
43
+ -webkit-font-smoothing: antialiased !important;
44
  }
45
 
46
+ .sidebar,
47
+ aside {
48
+ background: var(--sidebar-bg) !important;
49
+ border-right: 1px solid #27272a !important;
50
+ padding: 28px 20px !important;
51
+ min-width: 220px !important;
52
  }
53
 
54
+ .sidebar *,
55
+ aside * {
56
+ color: var(--sidebar-fg) !important;
 
57
  }
58
 
59
+ .sidebar h1,
60
+ aside h1 {
61
+ font-family: var(--font) !important;
62
+ font-size: 15px !important;
63
+ font-weight: 600 !important;
64
+ letter-spacing: -0.01em !important;
65
+ color: #ffffff !important;
66
+ margin-bottom: 12px !important;
67
  }
68
 
69
+ .sidebar p,
70
+ aside p {
71
+ font-size: 12.5px !important;
72
+ line-height: 1.65 !important;
73
+ color: var(--sidebar-mut) !important;
74
+ font-weight: 400 !important;
 
 
 
75
  }
76
 
77
+ .sidebar button,
78
+ aside button {
79
+ display: flex !important;
80
+ align-items: center !important;
81
+ justify-content: center !important;
82
+ gap: 6px !important;
83
+ width: 100% !important;
84
+ margin-top: 20px !important;
85
+ padding: 9px 16px !important;
86
+ background: #27272a !important;
87
+ color: #fafafa !important;
88
+ border: 1px solid #3f3f46 !important;
89
+ border-radius: var(--radius-sm) !important;
90
+ font-family: var(--font) !important;
91
+ font-size: 13px !important;
92
+ font-weight: 500 !important;
93
+ letter-spacing: -0.01em !important;
94
+ cursor: pointer !important;
95
+ transition: background 0.15s ease, border-color 0.15s ease !important;
96
  }
97
 
98
+ .sidebar button:hover,
99
+ aside button:hover {
100
+ background: #3f3f46 !important;
101
+ border-color: #52525b !important;
 
 
 
 
 
 
 
 
 
102
  }
103
 
104
+ .contain,
105
+ .gap {
106
+ background: var(--bg) !important;
107
  }
108
 
109
+ .chatbot,
110
+ div[data-testid="chatbot"] {
111
+ background: var(--bg) !important;
112
  border: 1px solid var(--border) !important;
113
+ border-radius: var(--radius) !important;
114
+ box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
115
+ overflow: hidden !important;
116
+ }
117
+
118
+ .message-wrap,
119
+ .messages {
120
+ padding: 20px !important;
121
+ background: var(--bg) !important;
122
+ }
123
+
124
+ .message {
125
+ max-width: 80% !important;
126
+ padding: 12px 16px !important;
127
+ border-radius: var(--radius) !important;
128
+ font-size: 14px !important;
129
+ line-height: 1.65 !important;
130
+ font-family: var(--font) !important;
131
+ }
132
+
133
+ .message.user,
134
+ .user.message {
135
+ background: var(--user-bubble) !important;
136
+ color: var(--user-fg) !important;
137
+ align-self: flex-end !important;
138
+ border-bottom-right-radius: 4px !important;
139
+ box-shadow: 0 1px 2px rgba(0,0,0,0.12) !important;
140
  }
141
 
142
+ .message.bot,
143
+ .bot.message {
144
+ background: var(--bot-bubble) !important;
145
+ color: var(--bot-fg) !important;
146
+ align-self: flex-start !important;
147
+ border-bottom-left-radius: 4px !important;
148
+ border: 1px solid var(--border-soft) !important;
149
  }
150
 
151
+ .chatbot label,
152
+ div[data-testid="chatbot"] > label {
153
+ font-family: var(--font) !important;
154
+ font-size: 11px !important;
155
+ font-weight: 500 !important;
156
+ text-transform: uppercase !important;
157
+ letter-spacing: 0.08em !important;
158
+ color: var(--text-faint) !important;
159
+ padding: 12px 16px !important;
160
+ border-bottom: 1px solid var(--border) !important;
161
+ background: var(--bg-subtle) !important;
162
  }
163
 
164
+ textarea,
165
+ input[type="text"],
166
+ .scroll-hide {
167
+ background: var(--bg-subtle) !important;
168
  border: 1px solid var(--border) !important;
169
+ border-radius: var(--radius-sm) !important;
170
+ color: var(--text) !important;
171
+ font-family: var(--font) !important;
172
+ font-size: 14px !important;
173
+ line-height: 1.5 !important;
174
+ padding: 10px 14px !important;
175
+ resize: none !important;
176
+ transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
177
+ caret-color: var(--accent) !important;
178
  }
179
 
180
+ textarea:focus,
181
+ input[type="text"]:focus {
182
+ border-color: #a1a1aa !important;
183
+ box-shadow: 0 0 0 3px rgba(24,24,27,0.06) !important;
184
  outline: none !important;
185
+ background: var(--bg) !important;
186
+ }
187
+
188
+ textarea::placeholder,
189
+ input[type="text"]::placeholder {
190
+ color: var(--text-faint) !important;
191
  }
192
 
193
+ button[variant="primary"],
194
+ .submit-btn {
195
+ background: var(--accent) !important;
196
+ color: var(--accent-fg) !important;
197
  border: none !important;
198
+ border-radius: var(--radius-sm) !important;
199
+ font-family: var(--font) !important;
200
+ font-size: 13px !important;
201
+ font-weight: 500 !important;
202
+ padding: 9px 18px !important;
203
+ transition: opacity 0.15s ease !important;
204
+ cursor: pointer !important;
205
+ }
206
+
207
+ button[variant="primary"]:hover,
208
+ .submit-btn:hover {
209
+ opacity: 0.82 !important;
210
+ }
211
+
212
+ button[variant="secondary"] {
213
+ background: var(--bg) !important;
214
+ color: var(--text) !important;
215
+ border: 1px solid var(--border) !important;
216
+ border-radius: var(--radius-sm) !important;
217
+ font-family: var(--font) !important;
218
+ font-size: 13px !important;
219
+ font-weight: 500 !important;
220
+ padding: 8px 14px !important;
221
+ transition: background 0.15s ease !important;
222
  }
223
 
224
+ button[variant="secondary"]:hover {
225
+ background: var(--bg-muted) !important;
226
  }
227
 
228
+ label span,
229
+ .label-wrap span {
230
+ font-family: var(--font) !important;
231
+ font-size: 11px !important;
232
+ font-weight: 500 !important;
233
+ letter-spacing: 0.04em !important;
234
+ color: var(--text-muted) !important;
235
  text-transform: uppercase !important;
 
236
  }
237
 
238
+ .block,
239
+ .gr-block {
240
+ border-radius: var(--radius) !important;
241
+ border-color: var(--border) !important;
242
+ background: var(--bg) !important;
243
+ }
244
+
245
+ ::-webkit-scrollbar { width: 5px; height: 5px; }
246
+ ::-webkit-scrollbar-track { background: transparent; }
247
+ ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
248
+ ::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
249
+
250
+ .examples td {
251
+ border-color: var(--border) !important;
252
+ background: var(--bg-subtle) !important;
253
+ font-family: var(--font) !important;
254
+ font-size: 13px !important;
255
+ color: var(--text-muted) !important;
256
+ border-radius: var(--radius-sm) !important;
257
+ }
258
+
259
+ .examples td:hover {
260
+ background: var(--bg-muted) !important;
261
+ color: var(--text) !important;
262
  }
263
 
264
+ footer,
265
+ .footer,
266
+ .built-with {
267
  display: none !important;
268
  }
269
  """
 
273
  css=custom_css,
274
  title="Yuuki-RxG",
275
  theme=gr.themes.Base(
276
+ primary_hue="zinc",
277
+ neutral_hue="zinc",
278
+ font=gr.themes.GoogleFont("Geist"),
279
+ font_mono=gr.themes.GoogleFont("Geist Mono"),
280
+ radius_size=gr.themes.sizes.radius_md,
281
+ spacing_size=gr.themes.sizes.spacing_md,
282
+ ).set(
283
+ body_background_fill="#ffffff",
284
+ body_text_color="#09090b",
285
+ background_fill_primary="#ffffff",
286
+ background_fill_secondary="#fafafa",
287
+ border_color_primary="#e4e4e7",
288
+ color_accent_soft="#f4f4f5",
289
+ button_primary_background_fill="#18181b",
290
+ button_primary_text_color="#ffffff",
291
+ button_secondary_background_fill="#ffffff",
292
+ button_secondary_border_color="#e4e4e7",
293
+ block_border_color="#e4e4e7",
294
+ block_background_fill="#ffffff",
295
+ input_background_fill="#fafafa",
296
+ input_border_color="#e4e4e7",
297
  )
298
  ) as demo:
299
  with gr.Sidebar():
300
  gr.Markdown("# Yuuki-RxG")
301
  gr.Markdown(
302
+ "Modelo servido via featherless-ai. "
303
  "Inicia sesión con tu cuenta de Hugging Face para acceder a la inferencia."
304
  )
305
  button = gr.LoginButton("Iniciar sesión")