Christen Millerdurai commited on
Commit
085306b
·
1 Parent(s): 11a5b82
Files changed (1) hide show
  1. app.py +281 -6
app.py CHANGED
@@ -17,20 +17,293 @@ EGOFORCE_ROOT = Path(os.environ.get("EGOFORCE_ROOT", SPACE_ROOT / "EgoForce")).r
17
  EGOFORCE_ASSETS_REPO_ID = os.environ.get("EGOFORCE_ASSETS_REPO_ID", "chris10/EgoForce")
18
  ZEROGPU_DURATION_SECONDS = os.environ.get("ZEROGPU_DURATION_SECONDS", "600")
19
  ZEROGPU_SIZE = os.environ.get("ZEROGPU_SIZE", "large")
20
- HERO_CSS_SPACE_PATCH_MARKER = "/* EgoForce Space patch: prose-safe hero sizing */"
21
  HERO_CSS_SPACE_PATCH = f"""
22
  {HERO_CSS_SPACE_PATCH_MARKER}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  .egoforce-hero-title,
24
  .prose .egoforce-hero .egoforce-hero-title {{
25
- font-size: clamp(2.6rem, 6vw, 4.8rem) !important;
26
- line-height: 1 !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  }}
28
 
29
  .egoforce-hero-icon,
30
  .prose .egoforce-hero img.egoforce-hero-icon {{
31
- height: clamp(3.2rem, 7vw, 5.4rem) !important;
32
- width: auto !important;
33
- max-width: none !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  }}
35
  """.strip()
36
 
@@ -193,6 +466,8 @@ def patch_upstream_gradio_hero_css(repo_root: Path) -> None:
193
 
194
  css_source = css_path.read_text(encoding="utf-8")
195
  if HERO_CSS_SPACE_PATCH_MARKER in css_source:
 
 
196
  return
197
 
198
  css_path.write_text(f"{css_source.rstrip()}\n\n{HERO_CSS_SPACE_PATCH}\n", encoding="utf-8")
 
17
  EGOFORCE_ASSETS_REPO_ID = os.environ.get("EGOFORCE_ASSETS_REPO_ID", "chris10/EgoForce")
18
  ZEROGPU_DURATION_SECONDS = os.environ.get("ZEROGPU_DURATION_SECONDS", "600")
19
  ZEROGPU_SIZE = os.environ.get("ZEROGPU_SIZE", "large")
20
+ HERO_CSS_SPACE_PATCH_MARKER = "/* EgoForce Space patch: dual-theme hero styling */"
21
  HERO_CSS_SPACE_PATCH = f"""
22
  {HERO_CSS_SPACE_PATCH_MARKER}
23
+ :root,
24
+ .gradio-container {{
25
+ --egoforce-bg-start: #fcf8f1;
26
+ --egoforce-bg-end: #f3ead8;
27
+ --egoforce-bg-accent: rgba(201, 95, 73, 0.14);
28
+ --egoforce-card-bg: linear-gradient(168deg, rgba(255, 251, 245, 0.96), rgba(246, 238, 225, 0.94));
29
+ --egoforce-card-border: rgba(173, 128, 93, 0.28);
30
+ --egoforce-shadow: 0 20px 52px rgba(111, 76, 44, 0.14);
31
+ --egoforce-text-primary: #1f2937;
32
+ --egoforce-text-secondary: #374151;
33
+ --egoforce-text-muted: #4b5563;
34
+ --egoforce-link-bg: rgba(255, 255, 255, 0.82);
35
+ --egoforce-link-border: rgba(128, 91, 58, 0.35);
36
+ --egoforce-link-text: #1f2937;
37
+ --egoforce-link-hover-bg: rgba(201, 95, 73, 0.15);
38
+ --egoforce-link-hover-border: rgba(201, 95, 73, 0.48);
39
+ }}
40
+
41
+ @media (prefers-color-scheme: dark) {{
42
+ :root,
43
+ .gradio-container {{
44
+ --egoforce-bg-start: #0b1020;
45
+ --egoforce-bg-end: #121a2f;
46
+ --egoforce-bg-accent: rgba(56, 189, 248, 0.18);
47
+ --egoforce-card-bg: linear-gradient(165deg, rgba(17, 24, 39, 0.94), rgba(30, 41, 59, 0.9));
48
+ --egoforce-card-border: rgba(125, 211, 252, 0.26);
49
+ --egoforce-shadow: 0 24px 56px rgba(2, 8, 23, 0.52);
50
+ --egoforce-text-primary: #e5e7eb;
51
+ --egoforce-text-secondary: #d1d5db;
52
+ --egoforce-text-muted: #cbd5e1;
53
+ --egoforce-link-bg: rgba(15, 23, 42, 0.62);
54
+ --egoforce-link-border: rgba(125, 211, 252, 0.4);
55
+ --egoforce-link-text: #e2e8f0;
56
+ --egoforce-link-hover-bg: rgba(14, 116, 144, 0.35);
57
+ --egoforce-link-hover-border: rgba(125, 211, 252, 0.65);
58
+ }}
59
+ }}
60
+
61
+ html.dark,
62
+ body.dark,
63
+ .dark,
64
+ html[data-theme="dark"],
65
+ body[data-theme="dark"] {{
66
+ --egoforce-bg-start: #0b1020;
67
+ --egoforce-bg-end: #121a2f;
68
+ --egoforce-bg-accent: rgba(56, 189, 248, 0.18);
69
+ --egoforce-card-bg: linear-gradient(165deg, rgba(17, 24, 39, 0.94), rgba(30, 41, 59, 0.9));
70
+ --egoforce-card-border: rgba(125, 211, 252, 0.26);
71
+ --egoforce-shadow: 0 24px 56px rgba(2, 8, 23, 0.52);
72
+ --egoforce-text-primary: #e5e7eb;
73
+ --egoforce-text-secondary: #d1d5db;
74
+ --egoforce-text-muted: #cbd5e1;
75
+ --egoforce-link-bg: rgba(15, 23, 42, 0.62);
76
+ --egoforce-link-border: rgba(125, 211, 252, 0.4);
77
+ --egoforce-link-text: #e2e8f0;
78
+ --egoforce-link-hover-bg: rgba(14, 116, 144, 0.35);
79
+ --egoforce-link-hover-border: rgba(125, 211, 252, 0.65);
80
+ }}
81
+
82
+ body,
83
+ .gradio-container {{
84
+ background-image:
85
+ radial-gradient(circle at center top, var(--egoforce-bg-accent), rgba(0, 0, 0, 0) 36%),
86
+ linear-gradient(180deg, var(--egoforce-bg-start) 0%, var(--egoforce-bg-end) 100%) !important;
87
+ color: var(--egoforce-text-primary) !important;
88
+ }}
89
+
90
+ .egoforce-hero-card,
91
+ .prose .egoforce-hero .egoforce-hero-card {{
92
+ background: var(--block-background-fill) !important;
93
+ background-image: linear-gradient(
94
+ 168deg,
95
+ color-mix(in srgb, var(--block-background-fill) 94%, #ffffff 6%),
96
+ color-mix(in srgb, var(--block-background-fill) 96%, #000000 4%)
97
+ ) !important;
98
+ border: 1px solid var(--block-border-color) !important;
99
+ box-shadow: var(--egoforce-shadow) !important;
100
+ }}
101
+
102
  .egoforce-hero-title,
103
  .prose .egoforce-hero .egoforce-hero-title {{
104
+ font-size: clamp(2.6rem, 6vw, 4.8rem) !important;
105
+ line-height: 1 !important;
106
+ color: var(--egoforce-text-primary) !important;
107
+ }}
108
+
109
+ .egoforce-brand-black,
110
+ .prose .egoforce-hero .egoforce-brand-black {{
111
+ color: var(--body-text-color) !important;
112
+ font-variant-caps: small-caps;
113
+ letter-spacing: 0.015em;
114
+ }}
115
+
116
+ .egoforce-brand-force,
117
+ .prose .egoforce-hero .egoforce-brand-force {{
118
+ color: #b42018 !important;
119
+ font-variant-caps: small-caps;
120
+ letter-spacing: 0.015em;
121
+ }}
122
+
123
+ .egoforce-hero-subtitle,
124
+ .egoforce-hero-authors,
125
+ .egoforce-hero-venue,
126
+ .prose .egoforce-hero .egoforce-hero-subtitle,
127
+ .prose .egoforce-hero .egoforce-hero-authors,
128
+ .prose .egoforce-hero .egoforce-hero-venue {{
129
+ color: var(--body-text-color) !important;
130
+ }}
131
+
132
+ .egoforce-hero-affiliations,
133
+ .egoforce-hero-caption,
134
+ .prose .egoforce-hero .egoforce-hero-affiliations,
135
+ .prose .egoforce-hero .egoforce-hero-caption {{
136
+ color: var(--body-text-color-subdued) !important;
137
  }}
138
 
139
  .egoforce-hero-icon,
140
  .prose .egoforce-hero img.egoforce-hero-icon {{
141
+ height: clamp(3.2rem, 7vw, 5.4rem) !important;
142
+ width: auto !important;
143
+ max-width: none !important;
144
+ }}
145
+
146
+ .egoforce-hero-link,
147
+ .prose .egoforce-hero .egoforce-hero-link {{
148
+ background: var(--egoforce-link-bg) !important;
149
+ border-color: var(--egoforce-link-border) !important;
150
+ color: var(--egoforce-link-text) !important;
151
+ }}
152
+
153
+ .egoforce-hero-link:hover,
154
+ .prose .egoforce-hero .egoforce-hero-link:hover {{
155
+ background: var(--egoforce-link-hover-bg) !important;
156
+ border-color: var(--egoforce-link-hover-border) !important;
157
+ }}
158
+
159
+ .egoforce-hero-link svg,
160
+ .prose .egoforce-hero .egoforce-hero-link svg {{
161
+ color: var(--egoforce-link-text) !important;
162
+ }}
163
+
164
+ @media (prefers-color-scheme: dark) {{
165
+ body,
166
+ .gradio-container {{
167
+ background-image:
168
+ radial-gradient(circle at center top, rgba(56, 189, 248, 0.18), rgba(0, 0, 0, 0) 36%),
169
+ linear-gradient(180deg, #0b1020 0%, #121a2f 100%) !important;
170
+ color: #e5e7eb !important;
171
+ }}
172
+
173
+ .egoforce-hero-card,
174
+ .prose .egoforce-hero .egoforce-hero-card {{
175
+ background: linear-gradient(165deg, rgba(17, 24, 39, 0.94), rgba(30, 41, 59, 0.9)) !important;
176
+ border-color: rgba(125, 211, 252, 0.26) !important;
177
+ box-shadow: 0 24px 56px rgba(2, 8, 23, 0.52) !important;
178
+ }}
179
+
180
+ .egoforce-hero-title,
181
+ .egoforce-hero-subtitle,
182
+ .egoforce-hero-authors,
183
+ .egoforce-hero-affiliations,
184
+ .egoforce-hero-venue,
185
+ .egoforce-hero-caption,
186
+ .prose .egoforce-hero .egoforce-hero-title,
187
+ .prose .egoforce-hero .egoforce-hero-subtitle,
188
+ .prose .egoforce-hero .egoforce-hero-authors,
189
+ .prose .egoforce-hero .egoforce-hero-affiliations,
190
+ .prose .egoforce-hero .egoforce-hero-venue,
191
+ .prose .egoforce-hero .egoforce-hero-caption {{
192
+ color: #e5e7eb !important;
193
+ }}
194
+
195
+ .egoforce-brand-black,
196
+ .prose .egoforce-hero .egoforce-brand-black {{
197
+ color: #e5e7eb !important;
198
+ }}
199
+
200
+ .egoforce-brand-force,
201
+ .prose .egoforce-hero .egoforce-brand-force {{
202
+ color: #b42018 !important;
203
+ }}
204
+
205
+ .egoforce-hero-link,
206
+ .prose .egoforce-hero .egoforce-hero-link {{
207
+ background: rgba(15, 23, 42, 0.62) !important;
208
+ border-color: rgba(125, 211, 252, 0.4) !important;
209
+ color: #e2e8f0 !important;
210
+ }}
211
+
212
+ .egoforce-hero-link:hover,
213
+ .prose .egoforce-hero .egoforce-hero-link:hover {{
214
+ background: rgba(14, 116, 144, 0.35) !important;
215
+ border-color: rgba(125, 211, 252, 0.65) !important;
216
+ }}
217
+
218
+ .egoforce-hero-link svg,
219
+ .prose .egoforce-hero .egoforce-hero-link svg {{
220
+ color: #e2e8f0 !important;
221
+ }}
222
+ }}
223
+
224
+ html.dark .egoforce-hero-card,
225
+ body.dark .egoforce-hero-card,
226
+ html[data-theme="dark"] .egoforce-hero-card,
227
+ body[data-theme="dark"] .egoforce-hero-card,
228
+ .dark .egoforce-hero-card,
229
+ html.dark .prose .egoforce-hero .egoforce-hero-card,
230
+ body.dark .prose .egoforce-hero .egoforce-hero-card,
231
+ html[data-theme="dark"] .prose .egoforce-hero .egoforce-hero-card,
232
+ body[data-theme="dark"] .prose .egoforce-hero .egoforce-hero-card,
233
+ .dark .prose .egoforce-hero .egoforce-hero-card {{
234
+ background: linear-gradient(165deg, rgba(17, 24, 39, 0.94), rgba(30, 41, 59, 0.9)) !important;
235
+ border-color: rgba(125, 211, 252, 0.26) !important;
236
+ box-shadow: 0 24px 56px rgba(2, 8, 23, 0.52) !important;
237
+ }}
238
+
239
+ html.dark .gradio-container,
240
+ body.dark .gradio-container,
241
+ html[data-theme="dark"] .gradio-container,
242
+ body[data-theme="dark"] .gradio-container,
243
+ .dark .gradio-container {{
244
+ background-image:
245
+ radial-gradient(circle at center top, rgba(56, 189, 248, 0.18), rgba(0, 0, 0, 0) 36%),
246
+ linear-gradient(180deg, #0b1020 0%, #121a2f 100%) !important;
247
+ color: #e5e7eb !important;
248
+ }}
249
+
250
+ html.dark .egoforce-hero-title,
251
+ html.dark .egoforce-hero-subtitle,
252
+ html.dark .egoforce-hero-authors,
253
+ html.dark .egoforce-hero-affiliations,
254
+ html.dark .egoforce-hero-venue,
255
+ html.dark .egoforce-hero-caption,
256
+ body.dark .egoforce-hero-title,
257
+ body.dark .egoforce-hero-subtitle,
258
+ body.dark .egoforce-hero-authors,
259
+ body.dark .egoforce-hero-affiliations,
260
+ body.dark .egoforce-hero-venue,
261
+ body.dark .egoforce-hero-caption,
262
+ html[data-theme="dark"] .egoforce-hero-title,
263
+ html[data-theme="dark"] .egoforce-hero-subtitle,
264
+ html[data-theme="dark"] .egoforce-hero-authors,
265
+ html[data-theme="dark"] .egoforce-hero-affiliations,
266
+ html[data-theme="dark"] .egoforce-hero-venue,
267
+ html[data-theme="dark"] .egoforce-hero-caption,
268
+ body[data-theme="dark"] .egoforce-hero-title,
269
+ body[data-theme="dark"] .egoforce-hero-subtitle,
270
+ body[data-theme="dark"] .egoforce-hero-authors,
271
+ body[data-theme="dark"] .egoforce-hero-affiliations,
272
+ body[data-theme="dark"] .egoforce-hero-venue,
273
+ body[data-theme="dark"] .egoforce-hero-caption,
274
+ .dark .egoforce-hero-title,
275
+ .dark .egoforce-hero-subtitle,
276
+ .dark .egoforce-hero-authors,
277
+ .dark .egoforce-hero-affiliations,
278
+ .dark .egoforce-hero-venue,
279
+ .dark .egoforce-hero-caption {{
280
+ color: #e5e7eb !important;
281
+ }}
282
+
283
+ html.dark .egoforce-brand-black,
284
+ body.dark .egoforce-brand-black,
285
+ html[data-theme="dark"] .egoforce-brand-black,
286
+ body[data-theme="dark"] .egoforce-brand-black,
287
+ .dark .egoforce-brand-black {{
288
+ color: #e5e7eb !important;
289
+ }}
290
+
291
+ html.dark .egoforce-brand-force,
292
+ body.dark .egoforce-brand-force,
293
+ html[data-theme="dark"] .egoforce-brand-force,
294
+ body[data-theme="dark"] .egoforce-brand-force,
295
+ .dark .egoforce-brand-force {{
296
+ color: #b42018 !important;
297
+ }}
298
+
299
+ html.dark .egoforce-hero-link,
300
+ body.dark .egoforce-hero-link,
301
+ html[data-theme="dark"] .egoforce-hero-link,
302
+ body[data-theme="dark"] .egoforce-hero-link,
303
+ .dark .egoforce-hero-link {{
304
+ background: rgba(15, 23, 42, 0.62) !important;
305
+ border-color: rgba(125, 211, 252, 0.4) !important;
306
+ color: #e2e8f0 !important;
307
  }}
308
  """.strip()
309
 
 
466
 
467
  css_source = css_path.read_text(encoding="utf-8")
468
  if HERO_CSS_SPACE_PATCH_MARKER in css_source:
469
+ base_css = css_source.split(HERO_CSS_SPACE_PATCH_MARKER, 1)[0].rstrip()
470
+ css_path.write_text(f"{base_css}\n\n{HERO_CSS_SPACE_PATCH}\n", encoding="utf-8")
471
  return
472
 
473
  css_path.write_text(f"{css_source.rstrip()}\n\n{HERO_CSS_SPACE_PATCH}\n", encoding="utf-8")