Commit ·
fbc801f
1
Parent(s): 2e78ab8
fix
Browse files18 unmodified lines192021222324255 unmodified lines3132333435363738 unmodified lines7677787980818283848586878 unmodified lines9697989910010110218 unmodified linesMAX_SEED = np.iinfo(np.int32).maxdef preprocess_image(image: Image.Image) -> Tuple[np.ndarray, Image.Image]:"""Preprocess the input image.5 unmodified linesImage.Image: The preprocessed image."""processed_image = pipeline.preprocess_image(image)return np.array(processed_image), processed_imagedef pack_state(gs: Gaussian, mesh: MeshExtractResult, model_id: str) -> dict:38 unmodified lines@spaces.GPUdef image_to_3d(image: np.array, seed: int, randomize_seed: bool, ss_guidance_strength: float, ss_sampling_steps: int, slat_guidance_strength: float, slat_sampling_steps: int) -> Tuple[dict, str]:"""Convert an image to a 3D model.Args:image (np.array): The input image.seed (int): The random seed.randomize_seed (bool): Whether to randomize the seed.ss_guidance_strength (float): The guidance strength for sparse structure generation.8 unmodified linesif randomize_seed:seed = np.random.randint(0, MAX_SEED)outputs = pipeline.run(Image.fromarray(image),seed=seed,formats=["gaussian", "mesh"],preprocess_image=False,18 unmodified lines192021222324255 unmodified lines3132333435363738 unmodified lines7677787980818283848586878 unmodified lines9697989910010110218 unmodified linesMAX_SEED = np.iinfo(np.int32).maxdef preprocess_image(image: Image.Image) -> Tuple[dict, Image.Image]:"""Preprocess the input image.5 unmodified linesImage.Image: The preprocessed image."""processed_image = pipeline.preprocess_image(image)return {'image': np.array(processed_image)}, processed_imagedef pack_state(gs: Gaussian, mesh: MeshExtractResult, model_id: str) -> dict:38 unmodified lines@spaces.GPUdef image_to_3d(image: dict, seed: int, randomize_seed: bool, ss_guidance_strength: float, ss_sampling_steps: int, slat_guidance_strength: float, slat_sampling_steps: int) -> Tuple[dict, str]:"""Convert an image to a 3D model.Args:image (dict): The input image.seed (int): The random seed.randomize_seed (bool): Whether to randomize the seed.ss_guidance_strength (float): The guidance strength for sparse structure generation.8 unmodified linesif randomize_seed:seed = np.random.randint(0, MAX_SEED)outputs = pipeline.run(Image.fromarray(image['image']),seed=seed,formats=["gaussian", "mesh"],preprocess_image=False,
app.py+5-5