Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,12 +4,31 @@ from PIL import Image, ImageDraw, ImageFont
|
|
| 4 |
import io
|
| 5 |
|
| 6 |
def main():
|
| 7 |
-
# Sidebar
|
| 8 |
st.sidebar.image("logo.png", use_container_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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
st.sidebar.write("3. Share your label in technical reports, announcements, etc.")
|
| 14 |
st.sidebar.markdown("[AI Energy Score Leaderboard](https://huggingface.co/spaces/AIEnergyScore/Leaderboard)")
|
| 15 |
|
|
|
|
| 4 |
import io
|
| 5 |
|
| 6 |
def main():
|
| 7 |
+
# Sidebar logo and title
|
| 8 |
st.sidebar.image("logo.png", use_container_width=True) # Display the logo at the top
|
| 9 |
st.sidebar.title("Label Generator")
|
| 10 |
+
|
| 11 |
+
# Instructions with integrated dropdown
|
| 12 |
st.sidebar.write("### Instructions:")
|
| 13 |
+
st.sidebar.write("1. Select a model from the dropdown below:")
|
| 14 |
+
model_options = data_df["model"].unique().tolist() # Get model options
|
| 15 |
+
selected_model = st.sidebar.selectbox(
|
| 16 |
+
"Select a Model", model_options, help="Start typing to search for a model"
|
| 17 |
+
) # Searchable dropdown
|
| 18 |
+
|
| 19 |
+
# Add step 2 instructions and move the Download button
|
| 20 |
+
st.sidebar.write("2. Review the label preview and download your label below:")
|
| 21 |
+
img_buffer = io.BytesIO()
|
| 22 |
+
generated_label.save(img_buffer, format="PNG")
|
| 23 |
+
img_buffer.seek(0)
|
| 24 |
+
st.sidebar.download_button(
|
| 25 |
+
label="Download Label as PNG",
|
| 26 |
+
data=img_buffer,
|
| 27 |
+
file_name="AIEnergyScore.png",
|
| 28 |
+
mime="image/png"
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
# Step 3 instructions
|
| 32 |
st.sidebar.write("3. Share your label in technical reports, announcements, etc.")
|
| 33 |
st.sidebar.markdown("[AI Energy Score Leaderboard](https://huggingface.co/spaces/AIEnergyScore/Leaderboard)")
|
| 34 |
|