soojeongcrystal commited on
Commit
0baff67
·
verified ·
1 Parent(s): 0260c6e

Upload main.py

Browse files
Files changed (1) hide show
  1. main.py +85 -0
main.py ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+
4
+ # Set page title and favicon
5
+ st.set_page_config(page_title="고민 해결사", page_icon=":sunglasses:")
6
+
7
+ st.markdown("""
8
+ <style>
9
+ .header {
10
+ font-size: 30px;
11
+ font-weight: bold;
12
+ margin-bottom: 20px;
13
+ color: #333; /* Dark gray color */
14
+ padding: 10px;
15
+ border-radius: 10px;
16
+ }
17
+ .description-box {
18
+ background-color: #f0f0f0; /* Light gray background */
19
+ padding: 10px;
20
+ border-radius: 10px;
21
+ margin-bottom: 10px;
22
+ }
23
+ </style>
24
+ """, unsafe_allow_html=True)
25
+
26
+ # Display the header
27
+ st.markdown('<div class="header">🏆 다른 팀장 고민해결 도와주기 🏆 </div>', unsafe_allow_html=True)
28
+
29
+ st.markdown("""
30
+ <div class="description-box">
31
+ <p> How to use </br> 1. 좌측에서 조언을 제공할 팀장의 연차를 선택해주세요. </br> 2. [고민 확인]버튼을 누르면 아래에 고민 내용과 조언 작성창이 뜹니다. </br> 3. 다시 한번 [고민 확인]버튼을 누르면 새로운 고민이 나옵니다 </br> </p>
32
+ </div>
33
+ """, unsafe_allow_html=True)
34
+
35
+ # Load Excel file into DataFrame
36
+ df = pd.read_excel("painpoint2.xlsx")
37
+
38
+ # Define experience level options
39
+ seniority_options = ['저연차 팀장', '중간연차 팀장', '고연차 팀장']
40
+
41
+ def set_background():
42
+ st.markdown(
43
+ """
44
+ <style>
45
+ .stApp {
46
+ background-image: url('URL_TO_YOUR_BACKGROUND_IMAGE');
47
+ background-size: cover;
48
+ }
49
+ </style>
50
+ """,
51
+ unsafe_allow_html=True
52
+ )
53
+
54
+ set_background()
55
+
56
+ st.sidebar.markdown("#\n" * 5)
57
+ # Add radio button to select experience level
58
+ st.sidebar.subheader("조언해줄 연차 선택하기:")
59
+ selected_experience = st.sidebar.radio(" ", seniority_options)
60
+ submit_button_left = st.sidebar.button("고민 확인")
61
+ # Initialize session state for button click
62
+ if 'button_clicked' not in st.session_state:
63
+ st.session_state['button_clicked'] = False
64
+
65
+ # Modify the button click to update session state
66
+ if submit_button_left:
67
+ st.session_state['button_clicked'] = True
68
+
69
+ # Display random rows based on selected experience level
70
+ if submit_button_left:
71
+ st.subheader("선택된 고민은?")
72
+ selected_row = df[selected_experience].sample(n=1)
73
+ with st.expander("고민 내용보기", expanded=True):
74
+ for column_name, cell_value in selected_row.items():
75
+ st.markdown(f"{cell_value}")
76
+
77
+ # Add advice section
78
+ st.subheader("고민 조언해주기")
79
+ st.write("다른 팀장님들의 고민에 대해 조언해주시겠어요?")
80
+ advice = st.text_area(" ", height=100)
81
+ submit_button_right = st.button("조언 제출하기")
82
+
83
+ if submit_button_right:
84
+ # TODO: Perform the task of saving the input advice
85
+ st.write("조언이 제출되었습니다 : )")