File size: 730 Bytes
f8f1d3f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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()