Spaces:
Runtime error
Runtime error
added print debugger
Browse files
app.py
CHANGED
|
@@ -153,8 +153,11 @@ def generate_3d_model(depth, image_path, focallength_px, simplification_factor=0
|
|
| 153 |
timestamp = int(time.time())
|
| 154 |
view_model_path = f'view_model_{timestamp}.obj'
|
| 155 |
download_model_path = f'download_model_{timestamp}.obj'
|
|
|
|
| 156 |
mesh.export(view_model_path)
|
|
|
|
| 157 |
mesh.export(download_model_path)
|
|
|
|
| 158 |
return view_model_path, download_model_path
|
| 159 |
|
| 160 |
def remove_thin_features(mesh, thickness_threshold=0.01):
|
|
@@ -191,7 +194,7 @@ def regenerate_3d_model(depth_csv, image_path, focallength_px, simplification_fa
|
|
| 191 |
depth, image_path, focallength_px,
|
| 192 |
simplification_factor, smoothing_iterations, thin_threshold
|
| 193 |
)
|
| 194 |
-
|
| 195 |
return view_model_path, download_model_path
|
| 196 |
|
| 197 |
@spaces.GPU(duration=20)
|
|
@@ -225,7 +228,7 @@ def predict_depth(input_image):
|
|
| 225 |
np.savetxt(raw_depth_path, depth, delimiter=',')
|
| 226 |
|
| 227 |
view_model_path, download_model_path = generate_3d_model(depth, temp_file, focallength_px)
|
| 228 |
-
|
| 229 |
return output_path, f"Focal length: {focallength_px:.2f} pixels", raw_depth_path, view_model_path, download_model_path, temp_file, focallength_px
|
| 230 |
except Exception as e:
|
| 231 |
import traceback
|
|
|
|
| 153 |
timestamp = int(time.time())
|
| 154 |
view_model_path = f'view_model_{timestamp}.obj'
|
| 155 |
download_model_path = f'download_model_{timestamp}.obj'
|
| 156 |
+
print("gonna export to view!")
|
| 157 |
mesh.export(view_model_path)
|
| 158 |
+
print("gonna export to download!")
|
| 159 |
mesh.export(download_model_path)
|
| 160 |
+
print("exported!")
|
| 161 |
return view_model_path, download_model_path
|
| 162 |
|
| 163 |
def remove_thin_features(mesh, thickness_threshold=0.01):
|
|
|
|
| 194 |
depth, image_path, focallength_px,
|
| 195 |
simplification_factor, smoothing_iterations, thin_threshold
|
| 196 |
)
|
| 197 |
+
print("regenerated!")
|
| 198 |
return view_model_path, download_model_path
|
| 199 |
|
| 200 |
@spaces.GPU(duration=20)
|
|
|
|
| 228 |
np.savetxt(raw_depth_path, depth, delimiter=',')
|
| 229 |
|
| 230 |
view_model_path, download_model_path = generate_3d_model(depth, temp_file, focallength_px)
|
| 231 |
+
print("Depth created - 3D model generated!")
|
| 232 |
return output_path, f"Focal length: {focallength_px:.2f} pixels", raw_depth_path, view_model_path, download_model_path, temp_file, focallength_px
|
| 233 |
except Exception as e:
|
| 234 |
import traceback
|