Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -83,18 +83,22 @@ def create_label(background_image, model_data):
|
|
| 83 |
title_font = ImageFont.truetype(inter_font_path, 24) # Bold for title
|
| 84 |
details_font = ImageFont.truetype(inter_font_path, 20) # Medium for details
|
| 85 |
energy_font = ImageFont.truetype(inter_font_path, 22) # Medium for energy
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
except Exception as e:
|
| 87 |
st.error(f"Font loading failed: {e}")
|
| 88 |
return label_img
|
| 89 |
|
| 90 |
# Define positions for each text group
|
| 91 |
title_x, title_y = 28, 124
|
| 92 |
-
details_x, details_y = 375,
|
| 93 |
-
energy_x, energy_y = 350,
|
| 94 |
|
| 95 |
# Group 1: Title (Left-Justified, no prefixes)
|
| 96 |
draw.text((title_x, title_y), str(model_data['model']), font=title_font, fill="black")
|
| 97 |
-
draw.text((title_x, title_y +
|
| 98 |
|
| 99 |
# Group 2: Details (Right-Justified, no prefixes)
|
| 100 |
details_lines = [
|
|
|
|
| 83 |
title_font = ImageFont.truetype(inter_font_path, 24) # Bold for title
|
| 84 |
details_font = ImageFont.truetype(inter_font_path, 20) # Medium for details
|
| 85 |
energy_font = ImageFont.truetype(inter_font_path, 22) # Medium for energy
|
| 86 |
+
|
| 87 |
+
# Set bold weight for title font
|
| 88 |
+
title_font = title_font.font_variant(weight=700) # Set font weight to bold
|
| 89 |
+
|
| 90 |
except Exception as e:
|
| 91 |
st.error(f"Font loading failed: {e}")
|
| 92 |
return label_img
|
| 93 |
|
| 94 |
# Define positions for each text group
|
| 95 |
title_x, title_y = 28, 124
|
| 96 |
+
details_x, details_y = 375, 208
|
| 97 |
+
energy_x, energy_y = 350, 388
|
| 98 |
|
| 99 |
# Group 1: Title (Left-Justified, no prefixes)
|
| 100 |
draw.text((title_x, title_y), str(model_data['model']), font=title_font, fill="black")
|
| 101 |
+
draw.text((title_x, title_y + 30), str(model_data['provider']), font=title_font, fill="black")
|
| 102 |
|
| 103 |
# Group 2: Details (Right-Justified, no prefixes)
|
| 104 |
details_lines = [
|