Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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]
|
| 40 |
-
open_ended = df['open_ended'][0]
|
| 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())
|