Spaces:
Running
on
Zero
Running
on
Zero
Update app.py (#1)
Browse files- Update app.py (83f96af76892ec7a082942e65d2d39571a770c53)
Co-authored-by: Ci Splunk <[email protected]>
app.py
CHANGED
@@ -71,7 +71,7 @@ def resize_image(image_path, max_size=1024):
|
|
71 |
img.save(temp_file, format="PNG")
|
72 |
return temp_file.name
|
73 |
|
74 |
-
@spaces.GPU
|
75 |
def generate_3d_model(depth, image_path, focallength_px, simplification_factor=1.0, smoothing_iterations=0, thin_threshold=0):
|
76 |
"""
|
77 |
Generate a textured 3D mesh from the depth map and the original image.
|
@@ -196,7 +196,7 @@ def remove_thin_features(mesh, thickness_threshold=0.01):
|
|
196 |
|
197 |
return mesh
|
198 |
|
199 |
-
@spaces.GPU
|
200 |
def regenerate_3d_model(depth_csv, image_path, focallength_px, simplification_factor, smoothing_iterations, thin_threshold):
|
201 |
# Load depth from CSV
|
202 |
depth = np.loadtxt(depth_csv, delimiter=',')
|
@@ -257,7 +257,7 @@ def predict_depth(input_image):
|
|
257 |
os.remove(temp_file)
|
258 |
print(f"Removed temporary file: {temp_file}")
|
259 |
|
260 |
-
@spaces.GPU
|
261 |
def create_3d_model(depth_csv, image_path, focallength_px, simplification_factor, smoothing_iterations, thin_threshold):
|
262 |
try:
|
263 |
depth = np.loadtxt(depth_csv, delimiter=',')
|
|
|
71 |
img.save(temp_file, format="PNG")
|
72 |
return temp_file.name
|
73 |
|
74 |
+
@spaces.GPU # Increased duration to default 60 seconds
|
75 |
def generate_3d_model(depth, image_path, focallength_px, simplification_factor=1.0, smoothing_iterations=0, thin_threshold=0):
|
76 |
"""
|
77 |
Generate a textured 3D mesh from the depth map and the original image.
|
|
|
196 |
|
197 |
return mesh
|
198 |
|
199 |
+
@spaces.GPU # Increased duration to default 60 seconds
|
200 |
def regenerate_3d_model(depth_csv, image_path, focallength_px, simplification_factor, smoothing_iterations, thin_threshold):
|
201 |
# Load depth from CSV
|
202 |
depth = np.loadtxt(depth_csv, delimiter=',')
|
|
|
257 |
os.remove(temp_file)
|
258 |
print(f"Removed temporary file: {temp_file}")
|
259 |
|
260 |
+
@spaces.GPU
|
261 |
def create_3d_model(depth_csv, image_path, focallength_px, simplification_factor, smoothing_iterations, thin_threshold):
|
262 |
try:
|
263 |
depth = np.loadtxt(depth_csv, delimiter=',')
|