Christen Millerdurai commited on
Commit
11a5b82
·
1 Parent(s): f0a5ba2
Files changed (1) hide show
  1. app.py +30 -0
app.py CHANGED
@@ -17,6 +17,22 @@ 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
 
21
 
22
  def run_command(command: list[str], cwd: Path | None = None) -> None:
@@ -94,6 +110,7 @@ def ensure_egoforce_repo() -> Path:
94
  if demo_entrypoint.exists():
95
  patch_upstream_gradio_for_zerogpu(demo_entrypoint)
96
  patch_upstream_tensorrt_fallback(EGOFORCE_ROOT)
 
97
  return EGOFORCE_ROOT
98
 
99
  if EGOFORCE_ROOT.exists() and any(EGOFORCE_ROOT.iterdir()):
@@ -117,6 +134,7 @@ def ensure_egoforce_repo() -> Path:
117
 
118
  patch_upstream_gradio_for_zerogpu(demo_entrypoint)
119
  patch_upstream_tensorrt_fallback(EGOFORCE_ROOT)
 
120
  return EGOFORCE_ROOT
121
 
122
 
@@ -168,6 +186,18 @@ def patch_upstream_gradio_for_zerogpu(demo_entrypoint: Path) -> None:
168
  demo_entrypoint.write_text(source, encoding="utf-8")
169
 
170
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  def patch_upstream_tensorrt_fallback(repo_root: Path) -> None:
172
  inference_path = repo_root / "demo" / "inference.py"
173
  demo_utils_path = repo_root / "demo" / "demo_utils.py"
 
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
 
37
 
38
  def run_command(command: list[str], cwd: Path | None = None) -> None:
 
110
  if demo_entrypoint.exists():
111
  patch_upstream_gradio_for_zerogpu(demo_entrypoint)
112
  patch_upstream_tensorrt_fallback(EGOFORCE_ROOT)
113
+ patch_upstream_gradio_hero_css(EGOFORCE_ROOT)
114
  return EGOFORCE_ROOT
115
 
116
  if EGOFORCE_ROOT.exists() and any(EGOFORCE_ROOT.iterdir()):
 
134
 
135
  patch_upstream_gradio_for_zerogpu(demo_entrypoint)
136
  patch_upstream_tensorrt_fallback(EGOFORCE_ROOT)
137
+ patch_upstream_gradio_hero_css(EGOFORCE_ROOT)
138
  return EGOFORCE_ROOT
139
 
140
 
 
186
  demo_entrypoint.write_text(source, encoding="utf-8")
187
 
188
 
189
+ def patch_upstream_gradio_hero_css(repo_root: Path) -> None:
190
+ css_path = repo_root / "assets" / "css" / "gradio_hero.css"
191
+ if not css_path.exists():
192
+ return
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")
199
+
200
+
201
  def patch_upstream_tensorrt_fallback(repo_root: Path) -> None:
202
  inference_path = repo_root / "demo" / "inference.py"
203
  demo_utils_path = repo_root / "demo" / "demo_utils.py"