Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse filesGPU task kept aborting when waiting on the generating model functions to complete. Removed duration parameter from spaces.GPU decorators on 3d model zeroGPU generation functions.
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=',')
|