Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -80,18 +80,18 @@ def create_label(background_image, model_data):
|
|
| 80 |
# Load fonts
|
| 81 |
try:
|
| 82 |
# Use Inter_24pt-Bold.ttf for the title
|
| 83 |
-
title_font = ImageFont.truetype("Inter_24pt-Bold.ttf", size=
|
| 84 |
# Use Inter-Regular.ttf for details and energy
|
| 85 |
-
details_font = ImageFont.truetype("Inter_18pt-Regular.ttf", size=
|
| 86 |
-
energy_font = ImageFont.truetype("Inter_18pt-Medium.ttf", size=
|
| 87 |
except Exception as e:
|
| 88 |
st.error(f"Font loading failed: {e}")
|
| 89 |
return label_img
|
| 90 |
|
| 91 |
# Define positions for each text group
|
| 92 |
-
title_x, title_y = 28,
|
| 93 |
-
details_x, details_y = 375,
|
| 94 |
-
energy_x, energy_y = 350,
|
| 95 |
|
| 96 |
# Group 1: Title (Bold)
|
| 97 |
draw.text((title_x, title_y), str(model_data['model']), font=title_font, fill="black")
|
|
|
|
| 80 |
# Load fonts
|
| 81 |
try:
|
| 82 |
# Use Inter_24pt-Bold.ttf for the title
|
| 83 |
+
title_font = ImageFont.truetype("Inter_24pt-Bold.ttf", size=22) # Bold for title
|
| 84 |
# Use Inter-Regular.ttf for details and energy
|
| 85 |
+
details_font = ImageFont.truetype("Inter_18pt-Regular.ttf", size=18) # Regular for details
|
| 86 |
+
energy_font = ImageFont.truetype("Inter_18pt-Medium.ttf", size=20) # Medium for energy
|
| 87 |
except Exception as e:
|
| 88 |
st.error(f"Font loading failed: {e}")
|
| 89 |
return label_img
|
| 90 |
|
| 91 |
# Define positions for each text group
|
| 92 |
+
title_x, title_y = 28, 128
|
| 93 |
+
details_x, details_y = 375, 210
|
| 94 |
+
energy_x, energy_y = 350, 390
|
| 95 |
|
| 96 |
# Group 1: Title (Bold)
|
| 97 |
draw.text((title_x, title_y), str(model_data['model']), font=title_font, fill="black")
|