geeek commited on
Commit
2e3fc87
·
verified ·
1 Parent(s): 8cfa77f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +136 -403
app.py CHANGED
@@ -1,411 +1,144 @@
1
  import gradio as gr
2
  import os
3
- css="""
4
- :root {
5
- --askcyph-bg: #0A0E1B;
6
- --askcyph-secondary-bg: #101826;
7
- --askcyph-card-bg: #1A2332;
8
- --askcyph-border: #2A3F5F;
9
- --askcyph-text: #E8EAED;
10
- --askcyph-text-secondary: #9CA3AF;
11
- --askcyph-accent: #0071bb;
12
- --askcyph-accent-hover: #005a94;
13
- --askcyph-accent-glow: rgba(0, 113, 187, 0.3);
14
- --askcyph-success: #10B981;
15
- --askcyph-error: #EF4444;
16
- --askcyph-gradient: linear-gradient(135deg, #0071bb 0%, #0080FF 100%);
17
- --askcyph-button-gradient: linear-gradient(135deg, #0071bb 0%, #005a94 100%);
18
-
19
- /* Override Gradio's primary colors */
20
- --primary-50: #e6f3ff !important;
21
- --primary-100: #b3daff !important;
22
- --primary-200: #80c1ff !important;
23
- --primary-300: #4da8ff !important;
24
- --primary-400: #1a8fff !important;
25
- --primary-500: #0071bb !important;
26
- --primary-600: #005a94 !important;
27
- --primary-700: #004470 !important;
28
- --primary-800: #002d4d !important;
29
- --primary-900: #001729 !important;
30
- --primary-950: #000b14 !important;
31
- }
32
- /* Force Gradio to use our color scheme */
33
- .gradio-container {
34
- --color-accent: #0071bb !important;
35
- --color-accent-soft: #0071bb20 !important;
36
- --slider-color: #0071bb !important;
37
- --primary-600: #0071bb !important;
38
- --primary-700: #005a94 !important;
39
- background-color: var(--askcyph-bg) !important;
40
- color: var(--askcyph-text) !important;
41
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
42
- }
43
- /* Override default styles */
44
- #col-container {
45
- margin: 0 auto;
46
- max-width: 1200px;
47
- background-color: transparent !important;
48
- }
49
- /* Header styling */
50
- .header-section {
51
- background: linear-gradient(180deg, rgba(26, 35, 50, 0.8) 0%, rgba(10, 14, 27, 0.9) 100%);
52
- padding: 2.5rem 0;
53
- margin-bottom: 2rem;
54
- border-bottom: 2px solid var(--askcyph-accent);
55
- text-align: center;
56
- position: relative;
57
- overflow: hidden;
58
- }
59
- .header-section::before {
60
- content: '';
61
- position: absolute;
62
- top: 0;
63
- left: 0;
64
- right: 0;
65
- height: 2px;
66
- background: var(--askcyph-gradient);
67
- animation: glow 3s ease-in-out infinite;
68
- }
69
- @keyframes glow {
70
- 0%, 100% { opacity: 0.6; }
71
- 50% { opacity: 1; }
72
- }
73
- .logo-container {
74
- display: inline-flex;
75
- justify-content: center;
76
- align-items: center;
77
- column-gap: 12px;
78
- margin-bottom: 1rem;
79
- }
80
- .logo-container .cyphertech {
81
- max-width: 8rem;
82
- width: 100%;
83
- height: auto;
84
- object-fit: contain;
85
- filter: brightness(1.1);
86
- }
87
- .logo-container .seperator:after {
88
- font-size: 3.5em;
89
- content: "|";
90
- color: var(--askcyph-accent);
91
- font-weight: 300;
92
- opacity: 0.5;
93
- }
94
- .logo-container .askcyph {
95
- max-width: 13rem;
96
- width: 100%;
97
- height: auto;
98
- object-fit: contain;
99
- filter: brightness(1.1);
100
- }
101
- /* Card styling */
102
- .generation-card {
103
- background-color: var(--askcyph-card-bg);
104
- border: 1px solid var(--askcyph-border);
105
- border-radius: 16px;
106
- padding: 2rem;
107
- margin-bottom: 1.5rem;
108
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
109
- position: relative;
110
- overflow: hidden;
111
- }
112
- .generation-card::before {
113
- content: '';
114
- position: absolute;
115
- top: 0;
116
- left: 0;
117
- right: 0;
118
- height: 1px;
119
- background: linear-gradient(90deg, transparent, var(--askcyph-accent), transparent);
120
- opacity: 0.5;
121
- }
122
- /* Tab styling */
123
- .tabs {
124
- margin-bottom: 1.5rem !important;
125
- }
126
- button[role="tab"] {
127
- background-color: transparent !important;
128
- color: var(--askcyph-text-secondary) !important;
129
- border: none !important;
130
- border-bottom: 3px solid transparent !important;
131
- padding: 1rem 1.5rem !important;
132
- font-weight: 600 !important;
133
- font-size: 0.95rem !important;
134
- transition: all 0.3s ease !important;
135
- position: relative !important;
136
- }
137
- button[role="tab"]:hover {
138
- color: var(--askcyph-text) !important;
139
- background-color: rgba(0, 113, 187, 0.05) !important;
140
- }
141
- button[role="tab"][aria-selected="true"] {
142
- color: var(--askcyph-accent) !important;
143
- border-bottom-color: var(--askcyph-accent) !important;
144
- background-color: rgba(0, 113, 187, 0.1) !important;
145
- }
146
- /* Input fields */
147
- .gr-text-input, .gr-number-input, textarea {
148
- background-color: rgba(16, 24, 38, 0.8) !important;
149
- border: 1px solid var(--askcyph-border) !important;
150
- color: var(--askcyph-text) !important;
151
- border-radius: 12px !important;
152
- padding: 0.75rem 1rem !important;
153
- transition: all 0.3s ease !important;
154
- }
155
- .gr-text-input:focus, .gr-number-input:focus, textarea:focus {
156
- border-color: var(--askcyph-accent) !important;
157
- box-shadow: 0 0 0 3px var(--askcyph-accent-glow) !important;
158
- background-color: rgba(16, 24, 38, 1) !important;
159
- }
160
- /* Button styling - Primary */
161
- .gr-button.primary, .gr-button[variant="primary"] {
162
- background: var(--askcyph-gradient) !important;
163
- color: white !important;
164
- border: none !important;
165
- border-radius: 12px !important;
166
- padding: 1rem 2rem !important;
167
- font-weight: 700 !important;
168
- font-size: 1rem !important;
169
- text-transform: uppercase !important;
170
- letter-spacing: 0.5px !important;
171
- transition: all 0.3s ease !important;
172
- position: relative !important;
173
- overflow: hidden !important;
174
- box-shadow: 0 4px 15px rgba(0, 113, 187, 0.3) !important;
175
- }
176
- .gr-button.primary:hover, .gr-button[variant="primary"]:hover {
177
- transform: translateY(-2px) !important;
178
- box-shadow: 0 6px 20px rgba(0, 113, 187, 0.4) !important;
179
- background: linear-gradient(135deg, #005a94 0%, #004470 100%) !important;
180
- }
181
- .gr-button.primary:active, .gr-button[variant="primary"]:active {
182
- transform: translateY(0) !important;
183
- }
184
- /* Secondary buttons */
185
- .gr-button:not(.primary):not([variant="primary"]) {
186
- background-color: rgba(42, 63, 95, 0.5) !important;
187
- color: var(--askcyph-text) !important;
188
- border: 1px solid var(--askcyph-border) !important;
189
- border-radius: 10px !important;
190
- padding: 0.75rem 1.5rem !important;
191
- font-weight: 600 !important;
192
- transition: all 0.3s ease !important;
193
- }
194
- .gr-button:not(.primary):not([variant="primary"]):hover {
195
- background-color: rgba(42, 63, 95, 0.8) !important;
196
- border-color: var(--askcyph-accent) !important;
197
- color: var(--askcyph-accent) !important;
198
- }
199
- /* COMPREHENSIVE SLIDER FIXES */
200
- /* Reset all slider elements */
201
- input[type="range"] {
202
- -webkit-appearance: none !important;
203
- appearance: none !important;
204
- background: transparent !important;
205
- cursor: pointer !important;
206
- width: 100% !important;
207
- }
208
- /* Slider track - all browsers */
209
- input[type="range"]::-webkit-slider-runnable-track {
210
- background: #2A3F5F !important;
211
- height: 4px !important;
212
- border-radius: 2px !important;
213
- }
214
- input[type="range"]::-moz-range-track {
215
- background: #2A3F5F !important;
216
- height: 4px !important;
217
- border-radius: 2px !important;
218
- }
219
- input[type="range"]::-ms-track {
220
- background: #2A3F5F !important;
221
- height: 4px !important;
222
- border-radius: 2px !important;
223
- border-color: transparent !important;
224
- color: transparent !important;
225
- }
226
- /* Slider thumb - all browsers */
227
- input[type="range"]::-webkit-slider-thumb {
228
- -webkit-appearance: none !important;
229
- appearance: none !important;
230
- background: #0071bb !important;
231
- border: 2px solid #0A0E1B !important;
232
- height: 16px !important;
233
- width: 16px !important;
234
- border-radius: 50% !important;
235
- cursor: pointer !important;
236
- margin-top: -6px !important;
237
- box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
238
- }
239
- input[type="range"]::-moz-range-thumb {
240
- background: #0071bb !important;
241
- border: 2px solid #0A0E1B !important;
242
- height: 16px !important;
243
- width: 16px !important;
244
- border-radius: 50% !important;
245
- cursor: pointer !important;
246
- box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
247
- }
248
- input[type="range"]::-ms-thumb {
249
- background: #0071bb !important;
250
- border: 2px solid #0A0E1B !important;
251
- height: 16px !important;
252
- width: 16px !important;
253
- border-radius: 50% !important;
254
- cursor: pointer !important;
255
- box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
256
- }
257
- /* Override Gradio's orange slider styles */
258
- .svelte-1cl284s {
259
- background-color: #0071bb !important;
260
- }
261
- /* Target any element that might have orange color */
262
- [style*="255, 126, 0"],
263
- [style*="251, 146, 60"],
264
- [style*="rgb(255, 126, 0)"],
265
- [style*="rgb(251, 146, 60)"],
266
- [style*="#ff7e00"],
267
- [style*="#fb923c"],
268
- [style*="orange"] {
269
- background-color: #0071bb !important;
270
- background: #0071bb !important;
271
- }
272
- /* Force override for Gradio's internal slider components */
273
- button, .gr-slider span[data-testid="slider-thumb"] {
274
- background-color: #0071bb !important;
275
- }
276
- .primary .gr-slider span[style*="background"] {
277
- background-color: #0071bb !important;
278
- }
279
- /* Target slider progress/fill elements */
280
- div[class*="slider"] span[style*="width"],
281
- div[class*="range"] span[style*="width"] {
282
- background-color: #0071bb !important;
283
- }
284
- /* Nuclear option for any remaining orange elements */
285
- * {
286
- --tw-gradient-from: #0071bb !important;
287
- --tw-gradient-to: #005a94 !important;
288
- --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
289
- }
290
- /* Checkbox styling */
291
- .gr-checkbox {
292
- display: flex !important;
293
- align-items: center !important;
294
- gap: 0.75rem !important;
295
- }
296
- .gr-checkbox input[type="checkbox"] {
297
- width: 20px !important;
298
- height: 20px !important;
299
- background-color: var(--askcyph-secondary-bg) !important;
300
- border: 2px solid var(--askcyph-border) !important;
301
- border-radius: 6px !important;
302
- transition: all 0.3s ease !important;
303
- }
304
- .gr-checkbox input[type="checkbox"]:checked {
305
- background: var(--askcyph-gradient) !important;
306
- border-color: var(--askcyph-accent) !important;
307
- }
308
- /* Accordion styling */
309
- .gr-accordion {
310
- background-color: rgba(26, 35, 50, 0.5) !important;
311
- border: 1px solid var(--askcyph-border) !important;
312
- border-radius: 12px !important;
313
- margin-top: 1rem !important;
314
- }
315
- .gr-accordion button {
316
- background-color: transparent !important;
317
- color: var(--askcyph-text) !important;
318
- font-weight: 600 !important;
319
- padding: 1rem !important;
320
- }
321
- .gr-accordion button:hover {
322
- color: var(--askcyph-accent) !important;
323
- }
324
- /* Labels */
325
- label {
326
- color: var(--askcyph-text) !important;
327
- font-weight: 600 !important;
328
- font-size: 0.9rem !important;
329
- text-transform: uppercase !important;
330
- letter-spacing: 0.5px !important;
331
- margin-bottom: 0.5rem !important;
332
- }
333
- /* Video/Image containers */
334
- .gr-video, .gr-image {
335
- background-color: rgba(16, 24, 38, 0.6) !important;
336
- border: 2px solid var(--askcyph-border) !important;
337
- border-radius: 12px !important;
338
- overflow: hidden !important;
339
- position: relative !important;
340
- }
341
- .gr-video::before, .gr-image::before {
342
- content: '';
343
- position: absolute;
344
- top: 0;
345
- left: 0;
346
- right: 0;
347
- bottom: 0;
348
- background: linear-gradient(135deg, transparent 0%, rgba(0, 113, 187, 0.1) 100%);
349
- pointer-events: none;
350
- }
351
- /* Output video special styling */
352
- #col-container > div > div:nth-child(2) .gr-video {
353
- border-color: var(--askcyph-accent) !important;
354
- box-shadow: 0 0 20px rgba(0, 113, 187, 0.2) !important;
355
- }
356
- /* Hide default Gradio branding */
357
- footer {
358
- display: none !important;
359
- }
360
- /* Custom footer */
361
- .custom-footer {
362
- margin-top: 3rem;
363
- padding: 2rem 0;
364
- border-top: 1px solid var(--askcyph-border);
365
- text-align: center;
366
- color: var(--askcyph-text-secondary);
367
- font-size: 0.85rem;
368
- background: linear-gradient(180deg, transparent 0%, rgba(10, 14, 27, 0.5) 100%);
369
- }
370
- .custom-footer a {
371
- color: var(--askcyph-accent);
372
- text-decoration: none;
373
- font-weight: 600;
374
- transition: all 0.3s ease;
375
- }
376
- .custom-footer a:hover {
377
- color: var(--askcyph-accent-hover);
378
- text-shadow: 0 0 10px var(--askcyph-accent-glow);
379
- }
380
- /* Loading animation */
381
- .gr-button.primary:disabled {
382
- background: linear-gradient(135deg, #666 0%, #888 100%) !important;
383
- cursor: not-allowed !important;
384
- animation: pulse 2s infinite !important;
385
- }
386
- @keyframes pulse {
387
- 0%, 100% { opacity: 0.6; }
388
- 50% { opacity: 1; }
389
- }
390
- /* Responsive */
391
- @media (max-width: 768px) {
392
- .header-section {
393
- padding: 1.5rem 0;
394
  }
395
-
396
- .generation-card {
397
- padding: 1.5rem;
 
 
398
  }
399
-
400
- .gr-button.primary, .gr-button[variant="primary"] {
401
- padding: 0.75rem 1.5rem !important;
402
- font-size: 0.9rem !important;
 
403
  }
404
- }
405
- #huggingface-space-header{
406
- display:none !important;
407
- }
408
- """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
 
410
  token = os.environ["TOKEN"]
411
  model=os.environ["MODEL"]
 
1
  import gradio as gr
2
  import os
3
+ css = """
4
+ :root {
5
+ --bg-primary: #0a0a0a;
6
+ --bg-secondary: #141414;
7
+ --bg-card: #1a1a1a;
8
+ --bg-hover: #252525;
9
+ --border-color: #2a2a2a;
10
+ --text-primary: #ffffff;
11
+ --text-secondary: #a0a0a0;
12
+ --accent-blue: #3b82f6;
13
+ --gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
15
+ /* Only change colors, not spacing */
16
+ .gradio-container {
17
+ background: var(--bg-primary) !important;
18
+ color: var(--text-primary) !important;
19
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
20
  }
21
+ /* Header styling */
22
+ .header-container {
23
+ text-align: center;
24
+ padding: 3rem 0 2rem;
25
+ background: var(--bg-primary);
26
  }
27
+ .logo-wrapper {
28
+ display: flex;
29
+ justify-content: center;
30
+ align-items: center;
31
+ gap: 2rem;
32
+ margin-bottom: 2rem;
33
+ }
34
+ .logo-divider {
35
+ width: 1px;
36
+ height: 40px;
37
+ background: var(--border-color);
38
+ }
39
+ .main-title {
40
+ font-size: 2rem;
41
+ font-weight: 400;
42
+ margin-bottom: 0.5rem;
43
+ color: var(--text-primary);
44
+ }
45
+ .subtitle {
46
+ color: var(--text-secondary);
47
+ font-size: 1rem;
48
+ }
49
+ /* Input styling */
50
+ .gr-input, .gr-textarea, textarea, input[type="text"], input[type="number"] {
51
+ background: var(--bg-secondary) !important;
52
+ border: 1px solid var(--border-color) !important;
53
+ color: var(--text-primary) !important;
54
+ border-radius: 8px !important;
55
+ }
56
+ .gr-input:focus, .gr-textarea:focus, textarea:focus, input:focus {
57
+ border-color: var(--accent-blue) !important;
58
+ outline: none !important;
59
+ background: var(--bg-hover) !important;
60
+ }
61
+ /* Button styling */
62
+ .primary-btn, .gr-button-primary {
63
+ background: var(--gradient) !important;
64
+ color: white !important;
65
+ border: none !important;
66
+ border-radius: 8px !important;
67
+ font-weight: 600 !important;
68
+ transition: all 0.2s ease !important;
69
+ }
70
+ .primary-btn:hover, .gr-button-primary:hover {
71
+ transform: translateY(-1px) !important;
72
+ box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3) !important;
73
+ }
74
+ .secondary-btn {
75
+ background: transparent !important;
76
+ color: var(--accent-blue) !important;
77
+ border: 1px solid var(--accent-blue) !important;
78
+ border-radius: 8px !important;
79
+ transition: all 0.2s ease !important;
80
+ }
81
+ .secondary-btn:hover {
82
+ background: var(--accent-blue) !important;
83
+ color: white !important;
84
+ }
85
+ /* Tab styling */
86
+ button[role="tab"] {
87
+ background: transparent !important;
88
+ color: var(--text-secondary) !important;
89
+ border: none !important;
90
+ border-radius: 8px !important;
91
+ font-weight: 500 !important;
92
+ transition: all 0.2s ease !important;
93
+ }
94
+ button[role="tab"]:hover {
95
+ background: var(--bg-hover) !important;
96
+ color: var(--text-primary) !important;
97
+ }
98
+ button[role="tab"][aria-selected="true"] {
99
+ background: var(--accent-blue) !important;
100
+ color: white !important;
101
+ }
102
+ /* Card backgrounds */
103
+ .gr-group {
104
+ background: var(--bg-card) !important;
105
+ border: 1px solid var(--border-color) !important;
106
+ border-radius: 12px !important;
107
+ }
108
+ /* Slider styling */
109
+ input[type="range"]::-webkit-slider-track {
110
+ background: var(--bg-secondary) !important;
111
+ height: 6px !important;
112
+ border-radius: 3px !important;
113
+ border: 1px solid var(--border-color) !important;
114
+ }
115
+ input[type="range"]::-webkit-slider-thumb {
116
+ -webkit-appearance: none !important;
117
+ background: var(--accent-blue) !important;
118
+ width: 18px !important;
119
+ height: 18px !important;
120
+ border-radius: 50% !important;
121
+ cursor: pointer !important;
122
+ }
123
+ /* Info message */
124
+ .info-message {
125
+ background: rgba(59, 130, 246, 0.1);
126
+ border: 1px solid var(--accent-blue);
127
+ border-radius: 8px;
128
+ padding: 1rem;
129
+ margin: 1rem 0;
130
+ color: var(--text-primary);
131
+ }
132
+ /* Footer */
133
+ .footer {
134
+ text-align: center;
135
+ padding: 3rem 0 2rem;
136
+ margin-top: 4rem;
137
+ border-top: 1px solid var(--border-color);
138
+ color: var(--text-secondary);
139
+ }
140
+ footer { display: none !important; }
141
+ """
142
 
143
  token = os.environ["TOKEN"]
144
  model=os.environ["MODEL"]