cvpfus Codex commited on
Commit ·
dcfbc01
1
Parent(s): 1043496
Align Space dependency metadata
Browse filesCo-authored-by: Codex <codex@openai.com>
- README.md +1 -1
- requirements.txt +1 -1
- scripts/verify.py +32 -0
README.md
CHANGED
|
@@ -69,7 +69,7 @@ Useful environment variables:
|
|
| 69 |
python scripts/verify.py
|
| 70 |
```
|
| 71 |
|
| 72 |
-
The verifier checks syntax, static assets, deterministic fallback model paths, and generated speech file behavior.
|
| 73 |
|
| 74 |
`/api/model-budget` exposes numeric parameter counts for every model role and reports whether the full stack stays within the 4B Tiny Titan limit.
|
| 75 |
|
|
|
|
| 69 |
python scripts/verify.py
|
| 70 |
```
|
| 71 |
|
| 72 |
+
The verifier checks syntax, static assets, Space metadata consistency, deterministic fallback model paths, and generated speech file behavior.
|
| 73 |
|
| 74 |
`/api/model-budget` exposes numeric parameter counts for every model role and reports whether the full stack stays within the 4B Tiny Titan limit.
|
| 75 |
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
gradio
|
| 2 |
pydantic>=2.7.0
|
| 3 |
kokoro>=0.9.4
|
| 4 |
soundfile>=0.12.1
|
|
|
|
| 1 |
+
gradio==6.16.0
|
| 2 |
pydantic>=2.7.0
|
| 3 |
kokoro>=0.9.4
|
| 4 |
soundfile>=0.12.1
|
scripts/verify.py
CHANGED
|
@@ -54,6 +54,37 @@ def verify_static_assets() -> None:
|
|
| 54 |
)
|
| 55 |
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
def verify_core_fallbacks() -> None:
|
| 58 |
narration = app.reader_brain_core(
|
| 59 |
node_type="heading",
|
|
@@ -265,6 +296,7 @@ def verify_routes() -> None:
|
|
| 265 |
def main() -> None:
|
| 266 |
py_compile.compile(str(ROOT / "app.py"), doraise=True)
|
| 267 |
verify_static_assets()
|
|
|
|
| 268 |
verify_core_fallbacks()
|
| 269 |
verify_routes()
|
| 270 |
print("Tiny Narrator verification passed.")
|
|
|
|
| 54 |
)
|
| 55 |
|
| 56 |
|
| 57 |
+
def front_matter_value(readme: str, key: str) -> str:
|
| 58 |
+
lines = readme.splitlines()
|
| 59 |
+
if not lines or lines[0] != "---":
|
| 60 |
+
return ""
|
| 61 |
+
for line in lines[1:]:
|
| 62 |
+
if line == "---":
|
| 63 |
+
break
|
| 64 |
+
name, separator, value = line.partition(":")
|
| 65 |
+
if separator and name.strip() == key:
|
| 66 |
+
return value.strip()
|
| 67 |
+
return ""
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def verify_space_metadata() -> None:
|
| 71 |
+
readme = (ROOT / "README.md").read_text(encoding="utf-8")
|
| 72 |
+
requirements = (ROOT / "requirements.txt").read_text(encoding="utf-8").splitlines()
|
| 73 |
+
|
| 74 |
+
sdk_version = front_matter_value(readme, "sdk_version")
|
| 75 |
+
app_file = front_matter_value(readme, "app_file")
|
| 76 |
+
sdk = front_matter_value(readme, "sdk")
|
| 77 |
+
|
| 78 |
+
assert_true(sdk == "gradio", "Space metadata should declare the Gradio SDK")
|
| 79 |
+
assert_true(app_file == "app.py", "Space metadata should launch app.py")
|
| 80 |
+
assert_true(f"gradio=={sdk_version}" in requirements, "requirements.txt should pin Gradio to sdk_version")
|
| 81 |
+
for package in ["pydantic", "kokoro", "soundfile"]:
|
| 82 |
+
assert_true(
|
| 83 |
+
any(line.startswith(f"{package}>=") or line.startswith(f"{package}==") for line in requirements),
|
| 84 |
+
f"requirements.txt should include {package}",
|
| 85 |
+
)
|
| 86 |
+
|
| 87 |
+
|
| 88 |
def verify_core_fallbacks() -> None:
|
| 89 |
narration = app.reader_brain_core(
|
| 90 |
node_type="heading",
|
|
|
|
| 296 |
def main() -> None:
|
| 297 |
py_compile.compile(str(ROOT / "app.py"), doraise=True)
|
| 298 |
verify_static_assets()
|
| 299 |
+
verify_space_metadata()
|
| 300 |
verify_core_fallbacks()
|
| 301 |
verify_routes()
|
| 302 |
print("Tiny Narrator verification passed.")
|