jonghhhh commited on
Commit
f4aa625
Β·
verified Β·
1 Parent(s): 52246c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -15,7 +15,6 @@ if user_type == "μ„€λ¬Έ μ„€μ •":
15
  question = st.text_input("μ„€λ¬Έ μ§ˆλ¬Έμ„ μž…λ ₯ν•˜μ„Έμš”:")
16
  options = st.text_area("μ„ νƒν˜• λ‹΅λ³€ ν•­λͺ©μ„ μž…λ ₯ν•˜μ„Έμš” (각 ν•­λͺ©μ„ μƒˆ 쀄에 μž…λ ₯):").split('\n')
17
  open_ended = st.checkbox("주관식 닡변도 ν—ˆμš©ν•˜κΈ°")
18
-
19
  if st.button("μ„€λ¬Έ μ‹œμž‘"):
20
  if question and options:
21
  data = {
@@ -32,20 +31,19 @@ if user_type == "μ„€λ¬Έ μ„€μ •":
32
  # 학생 응닡 νŽ˜μ΄μ§€
33
  elif user_type == "학생 응닡":
34
  st.title("ν•™μƒμš© μ„€λ¬Έ 응닡")
35
-
36
  if os.path.exists(survey_file_path):
37
  df = pd.read_csv(survey_file_path)
38
  question = df['question'][0]
39
- options = df['options'][0].strip("[]").replace("'", "").split(", ")
40
- open_ended = df['open_ended'][0] == 'True'
41
-
42
  st.write(f"### {question}")
43
  selected_option = st.radio("닡변을 μ„ νƒν•˜μ„Έμš”:", options)
44
-
45
  open_answer = ""
46
  if open_ended:
47
- open_answer = st.text_area("기타 μ˜κ²¬μ„ μž…λ ₯ν•˜μ„Έμš”:") # 주관식 λ‹΅λ³€ μž…λ ₯ μ°½ ν‘œμ‹œ
48
-
49
  if st.button("λ‹΅λ³€ 제좜"):
50
  # 응닡 데이터 μ €μž₯
51
  response_data = {
@@ -70,13 +68,10 @@ elif user_type == "학생 응닡":
70
  # κ²°κ³Ό 확인 νŽ˜μ΄μ§€ (κ΅μ‚¬μš©)
71
  elif user_type == "κ²°κ³Ό 확인":
72
  st.title("μ„€λ¬Έ κ²°κ³Ό 확인")
73
-
74
  if os.path.exists(responses_file_path):
75
  df = pd.read_csv(responses_file_path)
76
-
77
  st.write("### μ„ νƒν˜• λ‹΅λ³€ 뢄포")
78
  st.bar_chart(df['선택'].value_counts())
79
-
80
  if '주관식' in df.columns:
81
  st.write("### 주관식 λ‹΅λ³€")
82
  st.table(df['주관식'].dropna())
 
15
  question = st.text_input("μ„€λ¬Έ μ§ˆλ¬Έμ„ μž…λ ₯ν•˜μ„Έμš”:")
16
  options = st.text_area("μ„ νƒν˜• λ‹΅λ³€ ν•­λͺ©μ„ μž…λ ₯ν•˜μ„Έμš” (각 ν•­λͺ©μ„ μƒˆ 쀄에 μž…λ ₯):").split('\n')
17
  open_ended = st.checkbox("주관식 닡변도 ν—ˆμš©ν•˜κΈ°")
 
18
  if st.button("μ„€λ¬Έ μ‹œμž‘"):
19
  if question and options:
20
  data = {
 
31
  # 학생 응닡 νŽ˜μ΄μ§€
32
  elif user_type == "학생 응닡":
33
  st.title("ν•™μƒμš© μ„€λ¬Έ 응닡")
 
34
  if os.path.exists(survey_file_path):
35
  df = pd.read_csv(survey_file_path)
36
  question = df['question'][0]
37
+ options = eval(df['options'][0]) # λ¬Έμžμ—΄μ„ 리슀트둜 λ³€ν™˜
38
+ open_ended = df['open_ended'][0]
39
+
40
  st.write(f"### {question}")
41
  selected_option = st.radio("닡변을 μ„ νƒν•˜μ„Έμš”:", options)
42
+
43
  open_answer = ""
44
  if open_ended:
45
+ open_answer = st.text_area("주관식 닡변을 μž…λ ₯ν•˜μ„Έμš”:")
46
+
47
  if st.button("λ‹΅λ³€ 제좜"):
48
  # 응닡 데이터 μ €μž₯
49
  response_data = {
 
68
  # κ²°κ³Ό 확인 νŽ˜μ΄μ§€ (κ΅μ‚¬μš©)
69
  elif user_type == "κ²°κ³Ό 확인":
70
  st.title("μ„€λ¬Έ κ²°κ³Ό 확인")
 
71
  if os.path.exists(responses_file_path):
72
  df = pd.read_csv(responses_file_path)
 
73
  st.write("### μ„ νƒν˜• λ‹΅λ³€ 뢄포")
74
  st.bar_chart(df['선택'].value_counts())
 
75
  if '주관식' in df.columns:
76
  st.write("### 주관식 λ‹΅λ³€")
77
  st.table(df['주관식'].dropna())