Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -80,9 +80,9 @@ def create_label_single_pass(background_image, model_data, final_size=(520, 728)
|
|
80 |
|
81 |
# 2. Load fonts at sizes appropriate for a 520×728 label
|
82 |
try:
|
83 |
-
title_font = ImageFont.truetype("Inter_24pt-Bold.ttf", size=
|
84 |
-
details_font = ImageFont.truetype("Inter_18pt-Regular.ttf", size=
|
85 |
-
energy_font = ImageFont.truetype("Inter_18pt-Medium.ttf", size=
|
86 |
except Exception as e:
|
87 |
st.error(f"Font loading failed: {e}")
|
88 |
return bg_resized
|
@@ -90,9 +90,9 @@ def create_label_single_pass(background_image, model_data, final_size=(520, 728)
|
|
90 |
# 3. Place your text.
|
91 |
# You may need to experiment with x/y coordinates or font sizes
|
92 |
# to make it look right in 520×728.
|
93 |
-
title_x, title_y =
|
94 |
-
details_x, details_y =
|
95 |
-
energy_x, energy_y =
|
96 |
|
97 |
# Text 1 (title)
|
98 |
draw.text((title_x, title_y), str(model_data['model']), font=title_font, fill="black")
|
|
|
80 |
|
81 |
# 2. Load fonts at sizes appropriate for a 520×728 label
|
82 |
try:
|
83 |
+
title_font = ImageFont.truetype("Inter_24pt-Bold.ttf", size=24)
|
84 |
+
details_font = ImageFont.truetype("Inter_18pt-Regular.ttf", size=20)
|
85 |
+
energy_font = ImageFont.truetype("Inter_18pt-Medium.ttf", size=22)
|
86 |
except Exception as e:
|
87 |
st.error(f"Font loading failed: {e}")
|
88 |
return bg_resized
|
|
|
90 |
# 3. Place your text.
|
91 |
# You may need to experiment with x/y coordinates or font sizes
|
92 |
# to make it look right in 520×728.
|
93 |
+
title_x, title_y = 30, 110
|
94 |
+
details_x, details_y = 420, 250
|
95 |
+
energy_x, energy_y = 400, 450
|
96 |
|
97 |
# Text 1 (title)
|
98 |
draw.text((title_x, title_y), str(model_data['model']), font=title_font, fill="black")
|