Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,8 @@ import io
|
|
5 |
|
6 |
def main():
|
7 |
# Sidebar for dropdown, buttons, and instructions
|
8 |
-
st.sidebar.
|
|
|
9 |
st.sidebar.write("### Instructions:")
|
10 |
st.sidebar.write("1. Select a model from the dropdown.")
|
11 |
st.sidebar.write("2. Review the label preview.")
|
@@ -79,17 +80,17 @@ def create_label(background_image, model_data):
|
|
79 |
# Load the Inter variable font (no LAYOUT_RAQM)
|
80 |
try:
|
81 |
inter_font_path = "Inter-VariableFont_opsz,wght.ttf"
|
82 |
-
title_font = ImageFont.truetype(inter_font_path,
|
83 |
-
details_font = ImageFont.truetype(inter_font_path,
|
84 |
-
energy_font = ImageFont.truetype(inter_font_path,
|
85 |
except Exception as e:
|
86 |
st.error(f"Font loading failed: {e}")
|
87 |
return label_img
|
88 |
|
89 |
# Define positions for each text group
|
90 |
-
title_x, title_y =
|
91 |
-
details_x, details_y =
|
92 |
-
energy_x, energy_y =
|
93 |
|
94 |
# Group 1: Title (Left-Justified, no prefixes)
|
95 |
draw.text((title_x, title_y), str(model_data['model']), font=title_font, fill="black")
|
|
|
5 |
|
6 |
def main():
|
7 |
# Sidebar for dropdown, buttons, and instructions
|
8 |
+
st.sidebar.image("logo.png", use_column_width=True) # Display the logo at the top
|
9 |
+
st.sidebar.title("Label Generator")
|
10 |
st.sidebar.write("### Instructions:")
|
11 |
st.sidebar.write("1. Select a model from the dropdown.")
|
12 |
st.sidebar.write("2. Review the label preview.")
|
|
|
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, 18) # Medium for details
|
85 |
+
energy_font = ImageFont.truetype(inter_font_path, 20) # 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 = 50, 120
|
92 |
+
details_x, details_y = 350, 200
|
93 |
+
energy_x, energy_y = 400, 400
|
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")
|