jonghhhh commited on
Commit
baef142
Β·
verified Β·
1 Parent(s): fc2a80f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -4
app.py CHANGED
@@ -9,7 +9,7 @@ user_type = st.sidebar.selectbox("μ‚¬μš©μž μœ ν˜•μ„ μ„ νƒν•˜μ„Έμš”:", ["ν•™
9
  survey_file_path = "survey_data.csv"
10
  responses_file_path = "responses_data.csv"
11
 
12
- # μ„€λ¬Έ μ„€μ • νŽ˜μ΄μ§€ (κ΅μ‚¬μš©)
13
  if user_type == "μ„€λ¬Έ μ„€μ •":
14
  st.title("μ„€λ¬Έ μ„€μ •")
15
  question = st.text_input("μ„€λ¬Έ μ§ˆλ¬Έμ„ μž…λ ₯ν•˜μ„Έμš”:")
@@ -63,7 +63,8 @@ elif user_type == "학생 응닡":
63
  if st.button("λ‹΅λ³€ 제좜"):
64
  # 응닡 데이터 μ €μž₯
65
  response_data = {
66
- '응닡': [answer]
 
67
  }
68
  response_df = pd.DataFrame(response_data)
69
 
@@ -77,7 +78,7 @@ elif user_type == "학생 응닡":
77
  st.write(f"κ·€ν•˜μ˜ λ‹΅λ³€: {answer}")
78
 
79
  else:
80
- st.warning("섀문이 아직 μ„€μ •λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€. κ΅μ‚¬μ—κ²Œ λ¬Έμ˜ν•˜μ„Έμš”.")
81
 
82
  # κ²°κ³Ό 확인 νŽ˜μ΄μ§€ (κ΅μ‚¬μš©)
83
  elif user_type == "κ²°κ³Ό 확인":
@@ -89,7 +90,23 @@ elif user_type == "κ²°κ³Ό 확인":
89
  survey_df = pd.read_csv(survey_file_path)
90
  use_options = survey_df['use_options'][0]
91
  if use_options:
92
- st.bar_chart(df['응닡'].value_counts())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  st.table(df)
94
  else:
95
  st.warning("아직 제좜된 닡변이 μ—†μŠ΅λ‹ˆλ‹€.")
 
9
  survey_file_path = "survey_data.csv"
10
  responses_file_path = "responses_data.csv"
11
 
12
+ # μ„€λ¬Έ μ„€μ • νŽ˜μ΄μ§€ (κ°•μ‚¬μš©)
13
  if user_type == "μ„€λ¬Έ μ„€μ •":
14
  st.title("μ„€λ¬Έ μ„€μ •")
15
  question = st.text_input("μ„€λ¬Έ μ§ˆλ¬Έμ„ μž…λ ₯ν•˜μ„Έμš”:")
 
63
  if st.button("λ‹΅λ³€ 제좜"):
64
  # 응닡 데이터 μ €μž₯
65
  response_data = {
66
+ '응닡': [answer],
67
+ 'μœ ν˜•': ['객관식' if use_options and answer in options else '주관식']
68
  }
69
  response_df = pd.DataFrame(response_data)
70
 
 
78
  st.write(f"κ·€ν•˜μ˜ λ‹΅λ³€: {answer}")
79
 
80
  else:
81
+ st.warning("섀문이 아직 μ„€μ •λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€. κ°•μ‚¬μ—κ²Œ λ¬Έμ˜ν•˜μ„Έμš”.")
82
 
83
  # κ²°κ³Ό 확인 νŽ˜μ΄μ§€ (κ΅μ‚¬μš©)
84
  elif user_type == "κ²°κ³Ό 확인":
 
90
  survey_df = pd.read_csv(survey_file_path)
91
  use_options = survey_df['use_options'][0]
92
  if use_options:
93
+ # 객관식 μ‘λ‹΅λ§Œ ν•„ν„°λ§ν•˜μ—¬ λ§‰λŒ€ κ·Έλž˜ν”„ 생성
94
+ objective_responses = df[df['μœ ν˜•'] == '객관식']
95
+ if not objective_responses.empty:
96
+ st.bar_chart(objective_responses['응닡'].value_counts())
97
+ else:
98
+ st.info("아직 객관식 응닡이 μ—†μŠ΅λ‹ˆλ‹€.")
99
+
100
+ # 주관식 응닡 ν‘œμ‹œ
101
+ subjective_responses = df[df['μœ ν˜•'] == '주관식']
102
+ if not subjective_responses.empty:
103
+ st.write("### 주관식 응닡")
104
+ st.table(subjective_responses['응닡'])
105
+ else:
106
+ st.info("아직 주관식 응닡이 μ—†μŠ΅λ‹ˆλ‹€.")
107
+
108
+ # λͺ¨λ“  응닡 ν‘œμ‹œ
109
+ st.write("### λͺ¨λ“  응닡")
110
  st.table(df)
111
  else:
112
  st.warning("아직 제좜된 닡변이 μ—†μŠ΅λ‹ˆλ‹€.")