Upload 11 files
Browse files- HF_RUNTIME_FIX_RECEIPT_3.md +27 -0
- HF_Substrate_Video_Atomization_Runtime_v0_1_PATCHED5.zip.sha256 +1 -0
- app.py +32 -1
- requirements.txt +1 -1
HF_RUNTIME_FIX_RECEIPT_3.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# HF Runtime Fix Receipt 3
|
| 2 |
+
|
| 3 |
+
## Packet
|
| 4 |
+
HF_Substrate_Video_Atomization_Runtime_v0_1_PATCHED5
|
| 5 |
+
|
| 6 |
+
## Error addressed
|
| 7 |
+
The Hugging Face Space started, then crashed while Gradio generated API metadata:
|
| 8 |
+
|
| 9 |
+
- `TypeError: argument of type 'bool' is not iterable`
|
| 10 |
+
- `ValueError: When localhost is not accessible, a shareable link must be created.`
|
| 11 |
+
|
| 12 |
+
## Cause
|
| 13 |
+
The primary fault was a Gradio / gradio_client API-schema generation mismatch. Gradio attempted to convert a JSON schema fragment where `additionalProperties` was boolean. The gradio_client converter expected a dict-like schema and crashed.
|
| 14 |
+
|
| 15 |
+
The localhost/share error was downstream: because the root route failed during startup/API-info generation, Gradio concluded localhost was inaccessible.
|
| 16 |
+
|
| 17 |
+
## Fix applied
|
| 18 |
+
1. Added a narrow compatibility guard in `app.py` that maps boolean JSON-schema fragments to `Any` during Gradio API metadata conversion.
|
| 19 |
+
2. Changed launch call to bind explicitly for Hugging Face Spaces:
|
| 20 |
+
- `server_name="0.0.0.0"`
|
| 21 |
+
- `server_port=int(os.environ.get("PORT", "7860"))`
|
| 22 |
+
- `show_error=True`
|
| 23 |
+
3. Updated Gradio pin from `4.44.0` to `4.44.1` while preserving `huggingface_hub==0.25.2` to keep the previous `HfFolder` fix settled.
|
| 24 |
+
4. Removed transient `__pycache__` from the release packet.
|
| 25 |
+
|
| 26 |
+
## Boundary
|
| 27 |
+
No atomization logic, HIR/OAM receipt logic, frame sampling, hashing, OpenCV processing, trace-stack construction, or packet generation logic was changed.
|
HF_Substrate_Video_Atomization_Runtime_v0_1_PATCHED5.zip.sha256
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
67f1099db35ffb854d8d85adcb0e82b7176b4b8e7162648c809ceb205e0d6bcc HF_Substrate_Video_Atomization_Runtime_v0_1_PATCHED5.zip
|
app.py
CHANGED
|
@@ -11,6 +11,32 @@ import gradio as gr
|
|
| 11 |
import pandas as pd
|
| 12 |
from PIL import Image
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
APP_TITLE = "Substrate Video Atomization Runtime v0.1"
|
| 16 |
BOUNDARY_NOTE = (
|
|
@@ -517,4 +543,9 @@ This v0.1 Space demonstrates the source-bound data-hologram layer.
|
|
| 517 |
)
|
| 518 |
|
| 519 |
if __name__ == "__main__":
|
| 520 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
import pandas as pd
|
| 12 |
from PIL import Image
|
| 13 |
|
| 14 |
+
# Hugging Face / Gradio compatibility guard.
|
| 15 |
+
# Gradio 4.44.x can crash while generating API metadata when gradio_client
|
| 16 |
+
# receives boolean JSON-schema fragments such as additionalProperties: true.
|
| 17 |
+
# The UI route does not depend on that schema text, so preserve runtime behavior
|
| 18 |
+
# and map those boolean schema fragments to a safe Any type.
|
| 19 |
+
def _install_gradio_schema_guard() -> None:
|
| 20 |
+
try:
|
| 21 |
+
import gradio_client.utils as client_utils
|
| 22 |
+
except Exception:
|
| 23 |
+
return
|
| 24 |
+
|
| 25 |
+
original = getattr(client_utils, "_json_schema_to_python_type", None)
|
| 26 |
+
if original is None or getattr(original, "_hir_schema_guard", False):
|
| 27 |
+
return
|
| 28 |
+
|
| 29 |
+
def guarded_json_schema_to_python_type(schema, defs=None):
|
| 30 |
+
if isinstance(schema, bool):
|
| 31 |
+
return "Any"
|
| 32 |
+
return original(schema, defs)
|
| 33 |
+
|
| 34 |
+
guarded_json_schema_to_python_type._hir_schema_guard = True
|
| 35 |
+
client_utils._json_schema_to_python_type = guarded_json_schema_to_python_type
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
_install_gradio_schema_guard()
|
| 39 |
+
|
| 40 |
|
| 41 |
APP_TITLE = "Substrate Video Atomization Runtime v0.1"
|
| 42 |
BOUNDARY_NOTE = (
|
|
|
|
| 543 |
)
|
| 544 |
|
| 545 |
if __name__ == "__main__":
|
| 546 |
+
port = int(os.environ.get("PORT", "7860"))
|
| 547 |
+
demo.launch(
|
| 548 |
+
server_name="0.0.0.0",
|
| 549 |
+
server_port=port,
|
| 550 |
+
show_error=True,
|
| 551 |
+
)
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
gradio==4.44.
|
| 2 |
huggingface_hub==0.25.2
|
| 3 |
opencv-python-headless
|
| 4 |
numpy
|
|
|
|
| 1 |
+
gradio==4.44.1
|
| 2 |
huggingface_hub==0.25.2
|
| 3 |
opencv-python-headless
|
| 4 |
numpy
|