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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -8,10 +8,10 @@ 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
- # Files directory, assuming it is in the same location as the script
12
  files_dir = "files"
13
 
14
- # Ensure the model files are in the correct folder
15
  model_files = [
16
  "model1.glb",
17
  "model2.glb",
@@ -19,10 +19,13 @@ model_files = [
19
  "model4.glb"
20
  ]
21
 
22
- # Check if the files exist
23
  for model_file in model_files:
24
  file_path = os.path.join(files_dir, model_file)
25
- print(f"Checking {file_path}: {os.path.exists(file_path)}")
 
 
 
26
 
27
  with gr.Blocks() as demo:
28
  gr.Markdown(
@@ -39,7 +42,7 @@ with gr.Blocks() as demo:
39
 
40
  model_input.change(load_mesh_with_info, inputs=model_input, outputs=[model_output, file_info])
41
 
42
- # Examples with correct relative paths
43
  examples = [
44
  [os.path.join(files_dir, "model1.glb")],
45
  [os.path.join(files_dir, "model2.glb")],
@@ -57,3 +60,4 @@ if __name__ == "__main__":
57
 
58
 
59
 
 
 
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
  "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):
26
+ print(f"Error: {file_path} does not exist.")
27
+ else:
28
+ print(f"Found: {file_path}")
29
 
30
  with gr.Blocks() as demo:
31
  gr.Markdown(
 
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")],
 
60
 
61
 
62
 
63
+