generated from omadson/project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
32 lines (28 loc) · 928 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import streamlit as st
from src import palette
st.title('My palette generator')
uploaded_image = st.file_uploader(
'Upload a image',
type=['jpg','jpeg']
)
col1, col2 = st.columns(2)
if uploaded_image:
with col1:
st.image(uploaded_image)
with col2:
#st.button('Download')
n_clusters = st.slider('Number of colors', 2, 8, 5)
if st.button('Generate palette'):
with st.spinner('Generating palette...'):
cores,cores_hex = palette.get(uploaded_image, n_clusters)
figura = palette.show(cores)
st.pyplot(figura)
st.code(cores_hex)
btn = st.download_button(
label="Download image",
data=palette.save(figura),
file_name='palette.png',
mime="image/png"
)
st.text("Made by Brena Rodrigues ^-^")
st.text("github: brena-cmd")