Update SnapForm to version 0.10.10 and add technical documentation
- Bump SnapForm version in uv.lock from 0.9.30 to 0.10.10. - Introduce comprehensive technical documentation for SnapForm, detailing features, usage instructions, and development guidelines.
This commit is contained in:
@@ -24,6 +24,13 @@ RUNTIME_SCHEMA = 4
|
||||
HOST_SCHEMA = 2
|
||||
HOST_ADDRESS = "127.0.0.1"
|
||||
DEFAULT_STORAGE_ROOT = Path.home() / ".snapform"
|
||||
JOB_FOLDER_NAMES = {
|
||||
"INSTALL_RUNTIME": "install-runtime",
|
||||
"DOWNLOAD_MODEL": "download-model",
|
||||
"IMAGE_DEPTH": "depth-plane",
|
||||
"IMAGE_BACKGROUND": "remove-background",
|
||||
"ORIGINAL_FRAMES": "depth-plane",
|
||||
}
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -122,15 +129,26 @@ def temporary_input_path():
|
||||
return path / f"{uuid.uuid4().hex}.png"
|
||||
|
||||
|
||||
def temporary_input_directory():
|
||||
path = jobs_directory() / "inputs" / f"{uuid.uuid4().hex}"
|
||||
path.mkdir(parents=True, exist_ok=True)
|
||||
return path
|
||||
|
||||
|
||||
def job_folder_name(job_type):
|
||||
"""Return the folder name segment for a job type."""
|
||||
return JOB_FOLDER_NAMES.get(job_type, job_type.lower())
|
||||
|
||||
|
||||
def new_job_paths(job_type):
|
||||
timestamp = datetime.now().strftime("%Y%m%d-%H%M%S")
|
||||
token = uuid.uuid4().hex[:8]
|
||||
stem = f"{timestamp}-{job_type.lower()}-{token}"
|
||||
directory = jobs_directory()
|
||||
stem = f"{job_folder_name(job_type)}_{timestamp}"
|
||||
directory = jobs_directory() / stem
|
||||
directory.mkdir(parents=True, exist_ok=True)
|
||||
return {
|
||||
"log": directory / f"{stem}.log",
|
||||
"status": directory / f"{stem}.json",
|
||||
"result": directory / stem,
|
||||
"log": directory / f"{directory.name}.log",
|
||||
"status": directory / f"{directory.name}.json",
|
||||
"result": directory,
|
||||
}
|
||||
|
||||
|
||||
@@ -155,8 +173,9 @@ def install_runtime_command(status_path):
|
||||
executable = uv_executable()
|
||||
addon_preferences = preferences()
|
||||
backend = getattr(addon_preferences, "torch_backend", "CU128")
|
||||
pypi_index = getattr(addon_preferences, "pypi_index_url", "") or ""
|
||||
script = Path(__file__).with_name("bootstrap_runtime.py")
|
||||
return [
|
||||
command = [
|
||||
sys.executable,
|
||||
str(script),
|
||||
"--uv",
|
||||
@@ -174,6 +193,9 @@ def install_runtime_command(status_path):
|
||||
"--status",
|
||||
str(status_path),
|
||||
]
|
||||
if pypi_index:
|
||||
command.extend(["--pypi-index", pypi_index])
|
||||
return command
|
||||
|
||||
|
||||
def host_log_path():
|
||||
@@ -616,6 +638,8 @@ def remove_background_request(
|
||||
status_path,
|
||||
result_directory,
|
||||
model_key,
|
||||
video_frames=None,
|
||||
start_frame=1,
|
||||
):
|
||||
return HostJobRequest(
|
||||
{
|
||||
@@ -627,6 +651,39 @@ def remove_background_request(
|
||||
"output_dir": str(result_directory),
|
||||
"status": str(status_path),
|
||||
"device": settings.device.lower(),
|
||||
"video_frames": (
|
||||
settings.video_frames
|
||||
if video_frames is None
|
||||
else video_frames
|
||||
),
|
||||
"start_frame": start_frame,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def extract_frames_request(
|
||||
settings,
|
||||
input_path,
|
||||
status_path,
|
||||
result_directory,
|
||||
video_frames=None,
|
||||
start_frame=1,
|
||||
):
|
||||
return HostJobRequest(
|
||||
{
|
||||
"job_id": Path(status_path).stem,
|
||||
"command": "extract-frames",
|
||||
"parameters": {
|
||||
"input": str(input_path),
|
||||
"output_dir": str(result_directory),
|
||||
"status": str(status_path),
|
||||
"video_frames": (
|
||||
settings.video_frames
|
||||
if video_frames is None
|
||||
else video_frames
|
||||
),
|
||||
"start_frame": start_frame,
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -643,6 +700,7 @@ def reconstruct_request(
|
||||
process_res_method=None,
|
||||
use_ray_pose=None,
|
||||
remove_background=False,
|
||||
start_frame=1,
|
||||
):
|
||||
snapform_selected_key = model_key or selected_model_key(settings, export_format)
|
||||
snapform_selected_process_res = (
|
||||
@@ -673,6 +731,7 @@ def reconstruct_request(
|
||||
"show_cameras": 1 if settings.show_cameras else 0,
|
||||
"gs_views_interval": settings.gs_views_interval,
|
||||
"video_frames": settings.video_frames,
|
||||
"start_frame": start_frame,
|
||||
"device": settings.device.lower(),
|
||||
"use_ray_pose": 1 if snapform_selected_ray_pose else 0,
|
||||
"ref_view_strategy": settings.ref_view_strategy,
|
||||
|
||||
Reference in New Issue
Block a user