han-xudong commited on
Commit
8d56e62
·
verified ·
1 Parent(s): 11f8349

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -15,7 +15,7 @@ from huggingface_hub import hf_hub_download
15
  import onnxruntime as ort
16
 
17
  model_dict = {
18
- "BallNet": "asRobotics/ballnet",
19
  }
20
 
21
  vertices_dict = {}
@@ -42,19 +42,18 @@ cmin = 0.0
42
  cmax = 12.0
43
 
44
 
45
- def load_model(model_name="ballnet"):
46
- repo_id = f"asRobotics/{model_name}"
47
  model_filename = "model.onnx"
48
  model_path = hf_hub_download(repo_id=repo_id, filename=model_filename)
49
  return ort.InferenceSession(model_path)
50
 
51
 
52
  ort_dict = {}
53
- for name, path in model_dict.items():
54
  try:
55
- ort_dict[name] = load_model(name)
56
  except Exception as e:
57
- print(f"Warning: Could not load model '{name}' from '{path}'. Error: {e}")
58
 
59
 
60
  def make_double_sided(mesh: trimesh.Trimesh) -> trimesh.Trimesh:
 
15
  import onnxruntime as ort
16
 
17
  model_dict = {
18
+ "BallNet": "han-xudong/ballnet",
19
  }
20
 
21
  vertices_dict = {}
 
42
  cmax = 12.0
43
 
44
 
45
+ def load_model(repo_id):
 
46
  model_filename = "model.onnx"
47
  model_path = hf_hub_download(repo_id=repo_id, filename=model_filename)
48
  return ort.InferenceSession(model_path)
49
 
50
 
51
  ort_dict = {}
52
+ for name, repo_id in model_dict.items():
53
  try:
54
+ ort_dict[name] = load_model(repo_id)
55
  except Exception as e:
56
+ print(f"Warning: Could not load model '{name}' from '{repo_id}'. Error: {e}")
57
 
58
 
59
  def make_double_sided(mesh: trimesh.Trimesh) -> trimesh.Trimesh: