tile-room-visualizer / lib /samStatus.ts
richuj's picture
feat: initial project structure and UI components
e008c35
Raw History Blame Contribute Delete
599 Bytes
import { existsSync } from "node:fs";
export type SamStatus = {
checkpointConfigured: boolean;
checkpointExists: boolean;
modelType: string;
python: string;
};
export function getSamStatus(): SamStatus {
const checkpoint = process.env.SAM_CHECKPOINT;
const localPython = `${process.cwd()}/.venv/bin/python`;
return {
checkpointConfigured: Boolean(checkpoint),
checkpointExists: checkpoint ? existsSync(checkpoint) : false,
modelType: process.env.SAM_MODEL_TYPE ?? "vit_h",
python: process.env.SAM_PYTHON ?? (existsSync(localPython) ? localPython : "python3")
};
}