Spaces:
Running
Running
| import os | |
| from gradio_client import Client | |
| from constants import MAX_ATTEMPTS | |
| class GaussianToMeshClient: | |
| def __init__(self): | |
| self.client = Client("https://dylanebert-splat-to-mesh.hf.space/", upload_files=True, download_files=True) | |
| def run(self, shape): | |
| attempt = 1 | |
| mesh = None | |
| while attempt <= MAX_ATTEMPTS: | |
| try: | |
| mesh = self.to_mesh_client.predict(shape, api_name="/run") | |
| break | |
| except Exception as e: | |
| print(f"Attempt to convert Gaussian to Mesh Failed {attempt}/{MAX_ATTEMPTS}: {e}") | |
| attempt += 1 | |
| # time.sleep(1) | |
| return mesh | |
| Gau2Mesh_client = GaussianToMeshClient() |