bgamazay commited on
Commit
a2c400b
·
verified ·
1 Parent(s): 1ac62cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -77,16 +77,13 @@ def create_label(background_image, model_data):
77
  label_img = background_image.convert("RGBA")
78
  draw = ImageDraw.Draw(label_img)
79
 
80
- # Load the Inter variable font (no LAYOUT_RAQM)
81
  try:
82
- inter_font_path = "Inter-VariableFont_opsz,wght.ttf"
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
@@ -96,7 +93,7 @@ def create_label(background_image, model_data):
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
 
 
77
  label_img = background_image.convert("RGBA")
78
  draw = ImageDraw.Draw(label_img)
79
 
80
+ # Load fonts
81
  try:
82
+ # Use Inter_24pt-Bold.ttf for the title
83
+ title_font = ImageFont.truetype("Inter_24pt-Bold.ttf", size=16) # Bold for title
84
+ # Use Inter-Regular.ttf for details and energy
85
+ details_font = ImageFont.truetype("Inter-Regular.ttf", size=12) # Regular for details
86
+ energy_font = ImageFont.truetype("Inter-Medium.ttf", size=14) # Medium for energy
 
 
 
87
  except Exception as e:
88
  st.error(f"Font loading failed: {e}")
89
  return label_img
 
93
  details_x, details_y = 375, 208
94
  energy_x, energy_y = 350, 388
95
 
96
+ # Group 1: Title (Bold)
97
  draw.text((title_x, title_y), str(model_data['model']), font=title_font, fill="black")
98
  draw.text((title_x, title_y + 30), str(model_data['provider']), font=title_font, fill="black")
99