Skip to content

Commit bab6ea6

Browse files
Merge pull request #5340 from PhytoEpidemic/master
Fix divide by 0 error
2 parents b2f17dd + 119a945 commit bab6ea6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/textual_inversion/autocrop.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ def poi_average(pois, settings):
276276
weight += poi.weight
277277
x += poi.x * poi.weight
278278
y += poi.y * poi.weight
279-
avg_x = round(x / weight)
280-
avg_y = round(y / weight)
279+
avg_x = round(weight and x / weight)
280+
avg_y = round(weight and y / weight)
281281

282282
return PointOfInterest(avg_x, avg_y)
283283

@@ -338,4 +338,4 @@ def __init__(self, crop_width=512, crop_height=512, corner_points_weight=0.5, en
338338
self.face_points_weight = face_points_weight
339339
self.annotate_image = annotate_image
340340
self.destop_view_image = False
341-
self.dnn_model_path = dnn_model_path
341+
self.dnn_model_path = dnn_model_path

0 commit comments

Comments
 (0)