Upload 15 files
Browse files- src/version.py +2 -2
- src/worker_payload.py +90 -5
src/version.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
-
ASF_APP_VERSION = "v198.26.
|
| 4 |
-
ASF_RELEASE_NAME = "Agentic Space Factory v198.26.
|
| 5 |
|
| 6 |
|
| 7 |
def resolve_app_version(value: str | None = None) -> str:
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
+
ASF_APP_VERSION = "v198.26.89"
|
| 4 |
+
ASF_RELEASE_NAME = "Agentic Space Factory v198.26.89"
|
| 5 |
|
| 6 |
|
| 7 |
def resolve_app_version(value: str | None = None) -> str:
|
src/worker_payload.py
CHANGED
|
@@ -40,8 +40,8 @@ DEFAULT_FALLBACK_SPACE_HARDWARE = "a10g-large"
|
|
| 40 |
DEFAULT_MODEL_ID = "sshleifer/tiny-gpt2"
|
| 41 |
MAX_PI_REPAIR_ATTEMPTS = 3
|
| 42 |
DEFAULT_FACTORY_UPLOAD_RETRY_BUDGET = 1
|
| 43 |
-
APP_VERSION = "v198.26.
|
| 44 |
-
app_version = "v198.26.
|
| 45 |
|
| 46 |
# Internal agent/recovery files may be needed inside the transient Pi
|
| 47 |
# workspace, but they should not be published to the generated Space or shown
|
|
@@ -3375,6 +3375,23 @@ def gradio_file_kind_for_param(param: dict) -> str:
|
|
| 3375 |
return ""
|
| 3376 |
|
| 3377 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3378 |
def ensure_smoke_input_file(run_dir: Path, kind: str) -> str:
|
| 3379 |
smoke_dir = run_dir / "tests" / "smoke_inputs"
|
| 3380 |
smoke_dir.mkdir(parents=True, exist_ok=True)
|
|
@@ -3483,7 +3500,40 @@ def prepare_gradio_file_inputs(args: list, params: list[dict], run_dir: Path) ->
|
|
| 3483 |
if not kind:
|
| 3484 |
continue
|
| 3485 |
before = resolved[index]
|
| 3486 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3487 |
continue
|
| 3488 |
try:
|
| 3489 |
source, resolution = resolve_smoke_file_source(run_dir, before, kind)
|
|
@@ -16620,6 +16670,20 @@ def _schema_file_kind(param, index: int) -> str:
|
|
| 16620 |
return ""
|
| 16621 |
|
| 16622 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16623 |
def _is_validation_url_like(value) -> bool:
|
| 16624 |
text = str(value or "").strip().lower()
|
| 16625 |
return text.startswith(("http://", "https://", "hf://", "s3://", "gs://", "data:"))
|
|
@@ -16703,7 +16767,28 @@ def prepare_validation_file_inputs(api_name: str, schema, args: list, run_dir: P
|
|
| 16703 |
if not kind:
|
| 16704 |
continue
|
| 16705 |
before = resolved[index]
|
| 16706 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16707 |
continue
|
| 16708 |
source = before
|
| 16709 |
source_text = str(source or "").strip()
|
|
@@ -18992,7 +19077,7 @@ def smoke_generate(target_space_id: str, token: str, run_dir: Path, events_path:
|
|
| 18992 |
# write_json(run_dir / "tests" / "payload_source.json", payload_source_record)
|
| 18993 |
# write_json(run_dir / "tests" / "replay_source.json", replay_source)
|
| 18994 |
# write_json(run_dir / "tests" / "validation_preflight.json", validation_preflight)
|
| 18995 |
-
app_version = "v198.26.
|
| 18996 |
engine_version = "unified_gradio_validation_harness_v198_25_3"
|
| 18997 |
parent_build_run_id = os.environ.get("PARENT_BUILD_RUN_ID", "").strip()
|
| 18998 |
validation_mode = os.environ.get("VALIDATION_MODE") or os.environ.get("SPACE_TEST_POLICY_MODE") or "linked"
|
|
|
|
| 40 |
DEFAULT_MODEL_ID = "sshleifer/tiny-gpt2"
|
| 41 |
MAX_PI_REPAIR_ATTEMPTS = 3
|
| 42 |
DEFAULT_FACTORY_UPLOAD_RETRY_BUDGET = 1
|
| 43 |
+
APP_VERSION = "v198.26.89"
|
| 44 |
+
app_version = "v198.26.89"
|
| 45 |
|
| 46 |
# Internal agent/recovery files may be needed inside the transient Pi
|
| 47 |
# workspace, but they should not be published to the generated Space or shown
|
|
|
|
| 3375 |
return ""
|
| 3376 |
|
| 3377 |
|
| 3378 |
+
def gradio_file_list_for_param(param: dict) -> bool:
|
| 3379 |
+
"""Return true when a file-backed Gradio parameter expects a list payload."""
|
| 3380 |
+
if not isinstance(param, dict):
|
| 3381 |
+
return False
|
| 3382 |
+
name = str(param.get("name") or "").strip().lower().replace(" ", "_").replace("-", "_")
|
| 3383 |
+
component = str(param.get("component") or "").lower()
|
| 3384 |
+
haystack = f"{name} {component}"
|
| 3385 |
+
if "gallery" in haystack or "gallerydata" in haystack:
|
| 3386 |
+
return True
|
| 3387 |
+
name_parts = {part for part in re.split(r"[^a-z0-9]+", name) if part}
|
| 3388 |
+
return bool(name_parts & {"images", "videos", "audios", "files"})
|
| 3389 |
+
|
| 3390 |
+
|
| 3391 |
+
def _is_gradio_file_data_dict(value) -> bool:
|
| 3392 |
+
return isinstance(value, dict) and (value.get("meta") or {}).get("_type") == "gradio.FileData"
|
| 3393 |
+
|
| 3394 |
+
|
| 3395 |
def ensure_smoke_input_file(run_dir: Path, kind: str) -> str:
|
| 3396 |
smoke_dir = run_dir / "tests" / "smoke_inputs"
|
| 3397 |
smoke_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
| 3500 |
if not kind:
|
| 3501 |
continue
|
| 3502 |
before = resolved[index]
|
| 3503 |
+
if gradio_file_list_for_param(param):
|
| 3504 |
+
values = before if isinstance(before, list) else [before]
|
| 3505 |
+
converted = []
|
| 3506 |
+
item_conversions = []
|
| 3507 |
+
for item_index, item in enumerate(values):
|
| 3508 |
+
if _is_gradio_file_data_dict(item):
|
| 3509 |
+
converted.append(item)
|
| 3510 |
+
item_conversions.append({
|
| 3511 |
+
"item_index": item_index,
|
| 3512 |
+
"from_type": type(item).__name__,
|
| 3513 |
+
"action": "already_filedata",
|
| 3514 |
+
})
|
| 3515 |
+
continue
|
| 3516 |
+
source, resolution = resolve_smoke_file_source(run_dir, item, kind)
|
| 3517 |
+
converted.append(handle_file(str(source)))
|
| 3518 |
+
item_conversions.append({
|
| 3519 |
+
"item_index": item_index,
|
| 3520 |
+
"from_type": type(item).__name__,
|
| 3521 |
+
"source": str(source)[:500],
|
| 3522 |
+
"action": "handle_file",
|
| 3523 |
+
"resolution": resolution,
|
| 3524 |
+
})
|
| 3525 |
+
resolved[index] = converted
|
| 3526 |
+
conversions.append({
|
| 3527 |
+
"index": index,
|
| 3528 |
+
"name": str(param.get("name") or f"arg{index}"),
|
| 3529 |
+
"kind": kind,
|
| 3530 |
+
"from_type": type(before).__name__,
|
| 3531 |
+
"action": "handle_file_list",
|
| 3532 |
+
"item_count": len(converted),
|
| 3533 |
+
"items": item_conversions,
|
| 3534 |
+
})
|
| 3535 |
+
continue
|
| 3536 |
+
if _is_gradio_file_data_dict(before):
|
| 3537 |
continue
|
| 3538 |
try:
|
| 3539 |
source, resolution = resolve_smoke_file_source(run_dir, before, kind)
|
|
|
|
| 16670 |
return ""
|
| 16671 |
|
| 16672 |
|
| 16673 |
+
def _schema_file_list_for_param(param, index: int) -> bool:
|
| 16674 |
+
name = _schema_name(param, index).lower().replace(" ", "_").replace("-", "_")
|
| 16675 |
+
component = _schema_component(param)
|
| 16676 |
+
haystack = f"{name} {component}"
|
| 16677 |
+
if "gallery" in haystack or "gallerydata" in haystack:
|
| 16678 |
+
return True
|
| 16679 |
+
name_parts = {part for part in re.split(r"[^a-z0-9]+", name) if part}
|
| 16680 |
+
return bool(name_parts & {"images", "videos", "audios", "files"})
|
| 16681 |
+
|
| 16682 |
+
|
| 16683 |
+
def _is_validation_filedata_dict(value) -> bool:
|
| 16684 |
+
return isinstance(value, dict) and (value.get("meta") or {}).get("_type") == "gradio.FileData"
|
| 16685 |
+
|
| 16686 |
+
|
| 16687 |
def _is_validation_url_like(value) -> bool:
|
| 16688 |
text = str(value or "").strip().lower()
|
| 16689 |
return text.startswith(("http://", "https://", "hf://", "s3://", "gs://", "data:"))
|
|
|
|
| 16767 |
if not kind:
|
| 16768 |
continue
|
| 16769 |
before = resolved[index]
|
| 16770 |
+
if _schema_file_list_for_param(param, index):
|
| 16771 |
+
values = before if isinstance(before, list) else [before]
|
| 16772 |
+
converted = []
|
| 16773 |
+
item_conversions = []
|
| 16774 |
+
for item_index, item in enumerate(values):
|
| 16775 |
+
if _is_validation_filedata_dict(item):
|
| 16776 |
+
converted.append(item)
|
| 16777 |
+
item_conversions.append({"item_index": item_index, "from_type": type(item).__name__, "action": "already_filedata"})
|
| 16778 |
+
continue
|
| 16779 |
+
source = item
|
| 16780 |
+
source_text = str(source or "").strip()
|
| 16781 |
+
if kind in {"image", "audio", "file"} and (source is None or not _validation_media_source_is_usable(source)):
|
| 16782 |
+
source = _ensure_validation_input_file(run_dir, kind)
|
| 16783 |
+
converted.append(handle_file(str(source)))
|
| 16784 |
+
action = "handle_file"
|
| 16785 |
+
if source_text and str(source) != source_text:
|
| 16786 |
+
action = "replaced_unusable_media_source_with_smoke_file"
|
| 16787 |
+
item_conversions.append({"item_index": item_index, "from_type": type(item).__name__, "source": str(source)[:500], "original_source": source_text[:500], "action": action})
|
| 16788 |
+
resolved[index] = converted
|
| 16789 |
+
conversions.append({"index": index, "name": _schema_name(param, index), "kind": kind, "from_type": type(before).__name__, "action": "handle_file_list", "item_count": len(converted), "items": item_conversions})
|
| 16790 |
+
continue
|
| 16791 |
+
if _is_validation_filedata_dict(before):
|
| 16792 |
continue
|
| 16793 |
source = before
|
| 16794 |
source_text = str(source or "").strip()
|
|
|
|
| 19077 |
# write_json(run_dir / "tests" / "payload_source.json", payload_source_record)
|
| 19078 |
# write_json(run_dir / "tests" / "replay_source.json", replay_source)
|
| 19079 |
# write_json(run_dir / "tests" / "validation_preflight.json", validation_preflight)
|
| 19080 |
+
app_version = "v198.26.89"
|
| 19081 |
engine_version = "unified_gradio_validation_harness_v198_25_3"
|
| 19082 |
parent_build_run_id = os.environ.get("PARENT_BUILD_RUN_ID", "").strip()
|
| 19083 |
validation_mode = os.environ.get("VALIDATION_MODE") or os.environ.get("SPACE_TEST_POLICY_MODE") or "linked"
|