Skip to content

Commit

Permalink
[Feat] user guideline 추가 #25
Browse files Browse the repository at this point in the history
- human, garment의 guideline 추가
  • Loading branch information
Hyunmin-H committed Jul 23, 2023
1 parent 1efdf18 commit 262c8ea
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions backend/app/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@

category_pair = {'Upper':'upper_body', 'Lower':'lower_body', 'Upper & Lower':'upper_lower', 'Dress':'dresses'}

def user_guideline_for_human():

st.write(' ')
text1 = """<h4 style='text-align: center;'> 전신 사진을 넣어주세요. </h4>"""
text1 = """<h4 style='text-align: center;'> 최대한 머리와 발끝을 </h4>"""
text2 = """<h4 style='text-align: center;'> 사진의 위아래 테두리에 맞게 찍어주세요! </h4>"""

st.markdown(text1, unsafe_allow_html=True)
st.markdown(text2, unsafe_allow_html=True)

def user_guideline_for_garment():

st.write(' ')
text1 = """<h4 style='text-align: center;'> 상의, 하의, 드레스 카테고리를 선택 후, </h4>"""
text2 = """<h4 style='text-align: center;'> 단일 옷 사진을 넣어주세요 ! </h4>"""

st.markdown(text1, unsafe_allow_html=True)
st.markdown(text2, unsafe_allow_html=True)

def check_modelLoading():
api_url = "http://localhost:8001/get_boolean"
is_modelLoading = True
Expand All @@ -40,12 +59,14 @@ def main():

# target_img = Image.open('/opt/ml/user_db/input/buffer/target/target.jpg')
uploaded_target = st.file_uploader("Choose an target image", type=["jpg", "jpeg", "png"])

if uploaded_target:
target_bytes = uploaded_target.getvalue()
target_img = Image.open(io.BytesIO(target_bytes))

st.image(target_img, caption='Uploaded target Image')
else :
user_guideline_for_human()

with col2:
st.header("Cloth")
Expand All @@ -60,7 +81,10 @@ def main():
if selected_category == 'Upper & Lower':
uploaded_garment1 = st.file_uploader("Choose an upper image", type=["jpg", "jpeg", "png"])
uploaded_garment2 = st.file_uploader("Choose an lower image", type=["jpg", "jpeg", "png"])

print(uploaded_garment1, uploaded_garment2)
if not uploaded_garment1 and not uploaded_garment2 :
user_guideline_for_garment()

col2_1, col2_2, = st.columns([1,1])
with col2_1:
if uploaded_garment1:
Expand Down Expand Up @@ -90,6 +114,9 @@ def main():
else :
uploaded_garment = st.file_uploader("Choose an garment image", type=["jpg", "jpeg", "png"])

if not uploaded_garment :
user_guideline_for_garment()

if uploaded_garment:
garment_bytes = uploaded_garment.getvalue()
garment_img = Image.open(io.BytesIO(garment_bytes))
Expand Down

0 comments on commit 262c8ea

Please sign in to comment.