sudo-soldier commited on
Commit
fbd48b2
·
verified ·
1 Parent(s): a5f7088

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -8,10 +8,9 @@ def load_mesh_with_info(mesh_file):
8
  file_size = os.path.getsize(mesh_file) / 1024 # Convert to KB
9
  return mesh_file, f"File: {os.path.basename(mesh_file)}, Size: {file_size:.2f} KB"
10
 
11
- # Ensure the models are in the "files/" folder
12
  files_dir = "files"
13
 
14
- # The models should be in the files/ directory
15
  model_files = [
16
  "model1.glb",
17
  "model2.glb",
@@ -19,7 +18,7 @@ model_files = [
19
  "model4.glb"
20
  ]
21
 
22
- # Check if each model file exists in the directory
23
  for model_file in model_files:
24
  file_path = os.path.join(files_dir, model_file)
25
  if not os.path.exists(file_path):
@@ -42,15 +41,17 @@ with gr.Blocks() as demo:
42
 
43
  model_input.change(load_mesh_with_info, inputs=model_input, outputs=[model_output, file_info])
44
 
45
- # Corrected examples with absolute paths for models
46
- examples = [
47
- [os.path.join(files_dir, "model1.glb")],
48
- [os.path.join(files_dir, "model2.glb")],
49
- [os.path.join(files_dir, "model3.glb")],
50
- [os.path.join(files_dir, "model4.glb")],
51
- ]
52
 
53
- demo.examples = examples
 
 
 
 
 
 
 
 
 
54
 
55
  if __name__ == "__main__":
56
  demo.launch()
@@ -61,3 +62,4 @@ if __name__ == "__main__":
61
 
62
 
63
 
 
 
8
  file_size = os.path.getsize(mesh_file) / 1024 # Convert to KB
9
  return mesh_file, f"File: {os.path.basename(mesh_file)}, Size: {file_size:.2f} KB"
10
 
 
11
  files_dir = "files"
12
 
13
+
14
  model_files = [
15
  "model1.glb",
16
  "model2.glb",
 
18
  "model4.glb"
19
  ]
20
 
21
+
22
  for model_file in model_files:
23
  file_path = os.path.join(files_dir, model_file)
24
  if not os.path.exists(file_path):
 
41
 
42
  model_input.change(load_mesh_with_info, inputs=model_input, outputs=[model_output, file_info])
43
 
 
 
 
 
 
 
 
44
 
45
+ examples = gr.Examples(
46
+ examples=[
47
+ [os.path.join(files_dir, "model1.glb")],
48
+ [os.path.join(files_dir, "model2.glb")],
49
+ [os.path.join(files_dir, "model3.glb")],
50
+ [os.path.join(files_dir, "model4.glb")]
51
+ ],
52
+ inputs=model_input,
53
+ outputs=[model_output, file_info]
54
+ )
55
 
56
  if __name__ == "__main__":
57
  demo.launch()
 
62
 
63
 
64
 
65
+