mlbench123 commited on
Commit
fb63d76
·
verified ·
1 Parent(s): 2a8e1f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -171,11 +171,14 @@ def save_dxf_spline(inflated_contours, scaling_factor, height):
171
  msp = doc.modelspace()
172
 
173
  for contour in inflated_contours:
 
 
 
174
  try:
175
- resampled_contour = resample_contour(contour)
176
  points = [
177
  (x * scaling_factor, (height - y) * scaling_factor)
178
- for x, y in resampled_contour
179
  ]
180
  if len(points) >= 3:
181
  if np.linalg.norm(np.array(points[0]) - np.array(points[-1])) > 1e-2:
 
171
  msp = doc.modelspace()
172
 
173
  for contour in inflated_contours:
174
+ # Ensure contour has enough points
175
+ if len(contour) < spline_degree + 1:
176
+ raise gr.Error(f"Contour must have at least {spline_degree + 1} points, but has {len(contour)} points.")
177
  try:
178
+ # resampled_contour = resample_contour(contour)
179
  points = [
180
  (x * scaling_factor, (height - y) * scaling_factor)
181
+ for x, y in contour
182
  ]
183
  if len(points) >= 3:
184
  if np.linalg.norm(np.array(points[0]) - np.array(points[-1])) > 1e-2: