Winston de Jong commited on
Commit
e42d0f5
·
1 Parent(s): c217d80

tweak text display

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -72,7 +72,7 @@ def process_image_str(groupImageFilePath: str):
72
  groupImage = PIL.Image.open(groupImageFilePath)
73
  locations, images = face_detection.getCroppedImages(groupImage)
74
  groupImage_d = ImageDraw.ImageDraw(groupImage)
75
- font = ImageFont.truetype("Arial Bold.ttf", 35)
76
 
77
  labels = ""
78
  n = 1
@@ -86,7 +86,7 @@ def process_image_str(groupImageFilePath: str):
86
  outputs_t = model(intputTensor)
87
  _, pred_t = torch.max(outputs_t, dim=1)
88
  groupImage_d.rectangle(location, outline=(0, 255, 0), width=2)
89
- groupImage_d.text(location + (60, 30, 0, 0), f"{n}", fill=(0, 255, 0), font=font)
90
  labels += f"{n}: {celeb_list[pred_t.item()]}\n"
91
 
92
  n += 1
 
72
  groupImage = PIL.Image.open(groupImageFilePath)
73
  locations, images = face_detection.getCroppedImages(groupImage)
74
  groupImage_d = ImageDraw.ImageDraw(groupImage)
75
+ font = ImageFont.truetype("Arial Bold.ttf", 30)
76
 
77
  labels = ""
78
  n = 1
 
86
  outputs_t = model(intputTensor)
87
  _, pred_t = torch.max(outputs_t, dim=1)
88
  groupImage_d.rectangle(location, outline=(0, 255, 0), width=2)
89
+ groupImage_d.text((location[0] + 4, location[1] + 2), f"{n}", fill=(0, 255, 0), font=font)
90
  labels += f"{n}: {celeb_list[pred_t.item()]}\n"
91
 
92
  n += 1