OpceanAI commited on
Commit
42fccc9
·
verified ·
1 Parent(s): 56748e2

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +376 -0
app.py ADDED
@@ -0,0 +1,376 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ custom_css = """
4
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');
5
+
6
+ :root {
7
+ --bg: #0a0a0a;
8
+ --bg-card: #111111;
9
+ --bg-input: #141414;
10
+ --bg-hover: #1a1a1a;
11
+
12
+ --border: rgba(255, 255, 255, 0.07);
13
+ --border-hover: rgba(255, 255, 255, 0.14);
14
+ --border-focus: rgba(255, 255, 255, 0.25);
15
+
16
+ --text: #ffffff;
17
+ --text-muted: #6b6b6b;
18
+ --text-dim: #3d3d3d;
19
+
20
+ --green: #22c55e;
21
+ --green-dim: rgba(34, 197, 94, 0.15);
22
+
23
+ --user-bg: #1c1c1c;
24
+ --bot-bg: #111111;
25
+
26
+ --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
27
+ --mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
28
+
29
+ --r-sm: 4px;
30
+ --r-md: 6px;
31
+ --r-lg: 8px;
32
+ }
33
+
34
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
35
+
36
+ body,
37
+ .gradio-container,
38
+ .gradio-container > .main,
39
+ .gradio-container > .main > .wrap {
40
+ background: var(--bg) !important;
41
+ color: var(--text) !important;
42
+ font-family: var(--font) !important;
43
+ font-size: 13px !important;
44
+ line-height: 1.5 !important;
45
+ letter-spacing: -0.01em !important;
46
+ -webkit-font-smoothing: antialiased !important;
47
+ }
48
+
49
+ .sidebar, aside {
50
+ background: var(--bg) !important;
51
+ border-right: 1px solid var(--border) !important;
52
+ padding: 28px 20px !important;
53
+ min-width: 200px !important;
54
+ max-width: 220px !important;
55
+ display: flex !important;
56
+ flex-direction: column !important;
57
+ gap: 0 !important;
58
+ }
59
+
60
+ .sidebar *, aside * { color: var(--text) !important; }
61
+
62
+ .sidebar h1, aside h1 {
63
+ font-family: var(--font) !important;
64
+ font-size: 15px !important;
65
+ font-weight: 700 !important;
66
+ letter-spacing: -0.03em !important;
67
+ color: var(--text) !important;
68
+ line-height: 1.2 !important;
69
+ margin-bottom: 14px !important;
70
+ }
71
+
72
+ .sidebar h1::before, aside h1::before {
73
+ content: '● ' !important;
74
+ color: var(--green) !important;
75
+ font-size: 10px !important;
76
+ letter-spacing: 0 !important;
77
+ }
78
+
79
+ .sidebar p, aside p {
80
+ font-size: 12px !important;
81
+ line-height: 1.65 !important;
82
+ color: var(--text-muted) !important;
83
+ font-weight: 400 !important;
84
+ letter-spacing: 0 !important;
85
+ margin-bottom: 0 !important;
86
+ }
87
+
88
+ .sidebar button, aside button {
89
+ display: flex !important;
90
+ align-items: center !important;
91
+ justify-content: center !important;
92
+ width: 100% !important;
93
+ margin-top: 18px !important;
94
+ padding: 8px 16px !important;
95
+ height: 34px !important;
96
+ background: transparent !important;
97
+ color: var(--text) !important;
98
+ border: 1px solid var(--border-hover) !important;
99
+ border-radius: var(--r-md) !important;
100
+ font-family: var(--font) !important;
101
+ font-size: 12px !important;
102
+ font-weight: 500 !important;
103
+ letter-spacing: -0.01em !important;
104
+ cursor: pointer !important;
105
+ transition: border-color 0.12s, background 0.12s !important;
106
+ }
107
+
108
+ .sidebar button:hover, aside button:hover {
109
+ background: var(--bg-hover) !important;
110
+ border-color: var(--border-focus) !important;
111
+ }
112
+
113
+ .contain, .gap, .wrap,
114
+ div[class*="col"], div[class*="row"],
115
+ .gradio-container .block {
116
+ background: var(--bg) !important;
117
+ box-shadow: none !important;
118
+ }
119
+
120
+ .chatbot,
121
+ div[data-testid="chatbot"] {
122
+ background: var(--bg-card) !important;
123
+ border: 1px solid var(--border) !important;
124
+ border-radius: var(--r-lg) !important;
125
+ box-shadow: none !important;
126
+ overflow: hidden !important;
127
+ max-height: 420px !important;
128
+ }
129
+
130
+ .chatbot .label-wrap,
131
+ div[data-testid="chatbot"] .label-wrap {
132
+ background: var(--bg-card) !important;
133
+ border-bottom: 1px solid var(--border) !important;
134
+ padding: 9px 14px !important;
135
+ }
136
+
137
+ .chatbot .label-wrap span,
138
+ div[data-testid="chatbot"] .label-wrap span {
139
+ font-family: var(--mono) !important;
140
+ font-size: 10px !important;
141
+ font-weight: 500 !important;
142
+ letter-spacing: 0.1em !important;
143
+ color: var(--text-muted) !important;
144
+ text-transform: uppercase !important;
145
+ }
146
+
147
+ .chatbot .message-wrap,
148
+ div[data-testid="chatbot"] .message-wrap {
149
+ padding: 14px !important;
150
+ background: var(--bg-card) !important;
151
+ max-height: 340px !important;
152
+ overflow-y: auto !important;
153
+ display: flex !important;
154
+ flex-direction: column !important;
155
+ gap: 8px !important;
156
+ }
157
+
158
+ .message {
159
+ max-width: 82% !important;
160
+ padding: 9px 13px !important;
161
+ border-radius: var(--r-md) !important;
162
+ font-family: var(--font) !important;
163
+ font-size: 13px !important;
164
+ line-height: 1.6 !important;
165
+ letter-spacing: 0 !important;
166
+ }
167
+
168
+ .message.user, .user.message {
169
+ background: var(--user-bg) !important;
170
+ color: var(--text) !important;
171
+ align-self: flex-end !important;
172
+ border: 1px solid var(--border) !important;
173
+ border-bottom-right-radius: var(--r-sm) !important;
174
+ }
175
+
176
+ .message.bot, .bot.message {
177
+ background: var(--bot-bg) !important;
178
+ color: rgba(255,255,255,0.85) !important;
179
+ align-self: flex-start !important;
180
+ border: 1px solid var(--border) !important;
181
+ border-bottom-left-radius: var(--r-sm) !important;
182
+ }
183
+
184
+ .message code {
185
+ font-family: var(--mono) !important;
186
+ font-size: 11px !important;
187
+ background: #1a1a1a !important;
188
+ border: 1px solid var(--border) !important;
189
+ border-radius: var(--r-sm) !important;
190
+ padding: 1px 5px !important;
191
+ color: var(--green) !important;
192
+ }
193
+
194
+ .message pre {
195
+ font-family: var(--mono) !important;
196
+ font-size: 11px !important;
197
+ background: #111 !important;
198
+ border: 1px solid var(--border) !important;
199
+ border-radius: var(--r-md) !important;
200
+ padding: 10px 12px !important;
201
+ color: rgba(255,255,255,0.75) !important;
202
+ overflow-x: auto !important;
203
+ margin-top: 6px !important;
204
+ }
205
+
206
+ textarea,
207
+ input[type="text"],
208
+ .scroll-hide {
209
+ background: var(--bg-input) !important;
210
+ border: 1px solid var(--border) !important;
211
+ border-radius: var(--r-md) !important;
212
+ color: var(--text) !important;
213
+ font-family: var(--font) !important;
214
+ font-size: 13px !important;
215
+ line-height: 1.5 !important;
216
+ padding: 9px 12px !important;
217
+ resize: none !important;
218
+ transition: border-color 0.12s !important;
219
+ caret-color: var(--green) !important;
220
+ letter-spacing: 0 !important;
221
+ }
222
+
223
+ textarea:focus, input[type="text"]:focus {
224
+ border-color: var(--border-focus) !important;
225
+ outline: none !important;
226
+ box-shadow: none !important;
227
+ }
228
+
229
+ textarea::placeholder, input[type="text"]::placeholder {
230
+ color: var(--text-dim) !important;
231
+ }
232
+
233
+ button[variant="primary"], .submit-btn {
234
+ background: var(--text) !important;
235
+ color: var(--bg) !important;
236
+ border: none !important;
237
+ border-radius: var(--r-md) !important;
238
+ font-family: var(--font) !important;
239
+ font-size: 12px !important;
240
+ font-weight: 600 !important;
241
+ height: 34px !important;
242
+ padding: 0 16px !important;
243
+ letter-spacing: -0.01em !important;
244
+ cursor: pointer !important;
245
+ transition: opacity 0.12s !important;
246
+ }
247
+
248
+ button[variant="primary"]:hover, .submit-btn:hover {
249
+ opacity: 0.88 !important;
250
+ }
251
+
252
+ button[variant="secondary"] {
253
+ background: transparent !important;
254
+ color: var(--text-muted) !important;
255
+ border: 1px solid var(--border) !important;
256
+ border-radius: var(--r-md) !important;
257
+ font-family: var(--font) !important;
258
+ font-size: 12px !important;
259
+ height: 32px !important;
260
+ padding: 0 12px !important;
261
+ transition: border-color 0.12s, color 0.12s !important;
262
+ }
263
+
264
+ button[variant="secondary"]:hover {
265
+ border-color: var(--border-focus) !important;
266
+ color: var(--text) !important;
267
+ }
268
+
269
+ label span, .label-wrap span {
270
+ font-family: var(--mono) !important;
271
+ font-size: 10px !important;
272
+ font-weight: 500 !important;
273
+ letter-spacing: 0.1em !important;
274
+ color: var(--text-muted) !important;
275
+ text-transform: uppercase !important;
276
+ }
277
+
278
+ .block, .gr-block {
279
+ background: var(--bg) !important;
280
+ border-color: var(--border) !important;
281
+ border-radius: var(--r-lg) !important;
282
+ box-shadow: none !important;
283
+ }
284
+
285
+ .examples table { border: none !important; }
286
+
287
+ .examples td {
288
+ background: var(--bg-card) !important;
289
+ border: 1px solid var(--border) !important;
290
+ border-radius: var(--r-sm) !important;
291
+ font-family: var(--font) !important;
292
+ font-size: 12px !important;
293
+ color: var(--text-muted) !important;
294
+ padding: 7px 11px !important;
295
+ cursor: pointer !important;
296
+ transition: border-color 0.12s, color 0.12s !important;
297
+ }
298
+
299
+ .examples td:hover {
300
+ border-color: var(--border-hover) !important;
301
+ color: var(--text) !important;
302
+ }
303
+
304
+ ::-webkit-scrollbar { width: 3px; height: 3px; }
305
+ ::-webkit-scrollbar-track { background: transparent; }
306
+ ::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 99px; }
307
+ ::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
308
+ * { scrollbar-width: thin !important; scrollbar-color: var(--border-hover) transparent !important; }
309
+
310
+ footer, .footer, .built-with { display: none !important; }
311
+
312
+ @media (max-width: 768px) {
313
+ .sidebar, aside {
314
+ min-width: 100% !important;
315
+ max-width: 100% !important;
316
+ border-right: none !important;
317
+ border-bottom: 1px solid var(--border) !important;
318
+ padding: 20px 16px !important;
319
+ }
320
+ .message { max-width: 92% !important; }
321
+ }
322
+ """
323
+
324
+ with gr.Blocks(
325
+ fill_height=True,
326
+ css=custom_css,
327
+ title="Yuuki-RxG",
328
+ theme=gr.themes.Base(
329
+ primary_hue="zinc",
330
+ neutral_hue="zinc",
331
+ font=gr.themes.GoogleFont("Inter"),
332
+ font_mono=gr.themes.GoogleFont("JetBrains Mono"),
333
+ radius_size=gr.themes.sizes.radius_sm,
334
+ spacing_size=gr.themes.sizes.spacing_sm,
335
+ ).set(
336
+ body_background_fill="#0a0a0a",
337
+ body_text_color="#ffffff",
338
+ background_fill_primary="#0a0a0a",
339
+ background_fill_secondary="#111111",
340
+ border_color_primary="rgba(255,255,255,0.07)",
341
+ color_accent="#22c55e",
342
+ color_accent_soft="rgba(34,197,94,0.12)",
343
+ button_primary_background_fill="#ffffff",
344
+ button_primary_text_color="#0a0a0a",
345
+ button_primary_background_fill_hover="#e5e5e5",
346
+ button_secondary_background_fill="transparent",
347
+ button_secondary_border_color="rgba(255,255,255,0.07)",
348
+ button_secondary_text_color="#6b6b6b",
349
+ block_border_color="rgba(255,255,255,0.07)",
350
+ block_background_fill="#111111",
351
+ block_shadow="none",
352
+ input_background_fill="#141414",
353
+ input_border_color="rgba(255,255,255,0.07)",
354
+ input_border_color_focus="rgba(255,255,255,0.25)",
355
+ input_shadow_focus="none",
356
+ shadow_drop="none",
357
+ shadow_drop_lg="none",
358
+ )
359
+ ) as demo:
360
+ with gr.Sidebar():
361
+ gr.Markdown("# Yuuki-RxG")
362
+ gr.Markdown(
363
+ "Modelo servido via featherless-ai. "
364
+ "Inicia sesión con tu cuenta de Hugging Face para acceder a la inferencia."
365
+ )
366
+ button = gr.LoginButton("Iniciar sesión")
367
+
368
+ gr.load(
369
+ "models/OpceanAI/Yuuki-RxG",
370
+ accept_token=button,
371
+ provider="featherless-ai",
372
+ )
373
+
374
+ if __name__ == "__main__":
375
+ demo.launch()
376
+