Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,9 +5,25 @@ def load_mesh_with_info(mesh_file):
|
|
| 5 |
if not mesh_file:
|
| 6 |
return None, "No file selected"
|
| 7 |
|
| 8 |
-
file_size = os.path.getsize(mesh_file) / 1024
|
| 9 |
return mesh_file, f"File: {os.path.basename(mesh_file)}, Size: {file_size:.2f} KB"
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
with gr.Blocks() as demo:
|
| 12 |
gr.Markdown(
|
| 13 |
"""
|
|
@@ -23,11 +39,12 @@ with gr.Blocks() as demo:
|
|
| 23 |
|
| 24 |
model_input.change(load_mesh_with_info, inputs=model_input, outputs=[model_output, file_info])
|
| 25 |
|
|
|
|
| 26 |
examples = [
|
| 27 |
-
[os.path.join(
|
| 28 |
-
[os.path.join(
|
| 29 |
-
[os.path.join(
|
| 30 |
-
[os.path.join(
|
| 31 |
]
|
| 32 |
|
| 33 |
demo.examples = examples
|
|
@@ -39,3 +56,4 @@ if __name__ == "__main__":
|
|
| 39 |
|
| 40 |
|
| 41 |
|
|
|
|
|
|
| 5 |
if not mesh_file:
|
| 6 |
return None, "No file selected"
|
| 7 |
|
| 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",
|
| 18 |
+
"model3.glb",
|
| 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(
|
| 29 |
"""
|
|
|
|
| 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")],
|
| 46 |
+
[os.path.join(files_dir, "model3.glb")],
|
| 47 |
+
[os.path.join(files_dir, "model4.glb")],
|
| 48 |
]
|
| 49 |
|
| 50 |
demo.examples = examples
|
|
|
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
+
|