Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
import streamlit as st
|
2 |
import openai
|
3 |
import os
|
4 |
-
import
|
5 |
|
6 |
-
# OpenAI API
|
7 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
8 |
|
9 |
st.set_page_config(layout="wide")
|
@@ -13,10 +13,10 @@ def generate_living_record(data, school_level, subjects=None, major=None):
|
|
13 |
data_str = f"๊ต๊ณผ๋ชฉ: {', '.join(subjects) if subjects else ''}\n"
|
14 |
data_str += f"ํฌ๋ง์ ๊ณต: {major if major else ''}\n\n"
|
15 |
data_str += data
|
16 |
-
instruction_text = highschool_instruction
|
17 |
else:
|
18 |
data_str = data
|
19 |
-
instruction_text = instruction
|
20 |
|
21 |
response = openai.ChatCompletion.create(
|
22 |
model="gpt-4-mini",
|
@@ -32,15 +32,15 @@ def generate_living_record(data, school_level, subjects=None, major=None):
|
|
32 |
)
|
33 |
return response.choices[0].message.content
|
34 |
|
35 |
-
# Streamlit
|
36 |
st.title("์ํ๊ธฐ๋ก๋ถ ์์ฑ ์๋น์ค")
|
37 |
st.write("์ง์ ๊ธฐ๋ก์ ์
๋ ฅํ๊ฑฐ๋ ํค์๋๋ฅผ ์ ํํ์ฌ ์ํ๊ธฐ๋ก๋ถ ์์ฑ์ ํ์ํ ๊ด์ฐฐ ๊ฒฐ๊ณผ๋ฅผ ์ ๊ณตํ ์ ์์ต๋๋ค.")
|
38 |
st.write("GPT๋ ์ค์ ํ ์ ์์ต๋๋ค. ์ํ๋ ๊ฒฐ๊ณผ๊ฐ ๋์ค์ง ์๋๋ค๋ฉด ์์ฑ ๋ฒํผ์ ๋ค์ ๋๋ฌ๋ณด์ธ์.")
|
39 |
|
40 |
-
#
|
41 |
school_level = st.radio("ํ๊ต๊ธ ์ ํ", ["์ด๋ฑํ๊ต", "์คยท๊ณ ๋ฑํ๊ต"])
|
42 |
|
43 |
-
#
|
44 |
subjects = None
|
45 |
major = None
|
46 |
if school_level == "์คยท๊ณ ๋ฑํ๊ต":
|
@@ -49,7 +49,7 @@ if school_level == "์คยท๊ณ ๋ฑํ๊ต":
|
|
49 |
subjects = st.multiselect("๊ต๊ณผ๋ชฉ ์ ํ", subject_options)
|
50 |
major = st.text_input("ํฌ๋ง์ ๊ณต")
|
51 |
|
52 |
-
#
|
53 |
attitude_keywords = [
|
54 |
"์ง์ค๋ ฅ", "๊ณผ์ ์ดํด", "๋ฐํ", "๋ฌธ์ ํด๊ฒฐ๋ ฅ", "๊ณผ์ ์ํ", "๊ด์ฐฐ๋ ฅ",
|
55 |
"ํ๊ตฌ๋ ฅ", "์๊ธฐ ์๊ฐ ํํ", "๋
ผ๋ฆฌ์ ์ฌ๊ณ ๋ ฅ", "์ด๋์ ๊ฒฝ", "ํ๋์ฌ",
|
@@ -73,7 +73,7 @@ personality_keywords = [
|
|
73 |
"๋ฏธ์", "์ฌ์น", "์ ๋จธ", "์ต์ธํจ", "์ฐ์ธํจ", "๋ถ์ ์ "
|
74 |
]
|
75 |
|
76 |
-
#
|
77 |
col1, col2 = st.columns(2)
|
78 |
|
79 |
with col1:
|
|
|
1 |
import streamlit as st
|
2 |
import openai
|
3 |
import os
|
4 |
+
import instructions
|
5 |
|
6 |
+
# OpenAI API ์ค์
|
7 |
openai.api_key = os.getenv("OPENAI_API_KEY")
|
8 |
|
9 |
st.set_page_config(layout="wide")
|
|
|
13 |
data_str = f"๊ต๊ณผ๋ชฉ: {', '.join(subjects) if subjects else ''}\n"
|
14 |
data_str += f"ํฌ๋ง์ ๊ณต: {major if major else ''}\n\n"
|
15 |
data_str += data
|
16 |
+
instruction_text = instructions.highschool_instruction
|
17 |
else:
|
18 |
data_str = data
|
19 |
+
instruction_text = instructions.instruction
|
20 |
|
21 |
response = openai.ChatCompletion.create(
|
22 |
model="gpt-4-mini",
|
|
|
32 |
)
|
33 |
return response.choices[0].message.content
|
34 |
|
35 |
+
# Streamlit ์ฑ ๊ตฌ์ฑ
|
36 |
st.title("์ํ๊ธฐ๋ก๋ถ ์์ฑ ์๋น์ค")
|
37 |
st.write("์ง์ ๊ธฐ๋ก์ ์
๋ ฅํ๊ฑฐ๋ ํค์๋๋ฅผ ์ ํํ์ฌ ์ํ๊ธฐ๋ก๋ถ ์์ฑ์ ํ์ํ ๊ด์ฐฐ ๊ฒฐ๊ณผ๋ฅผ ์ ๊ณตํ ์ ์์ต๋๋ค.")
|
38 |
st.write("GPT๋ ์ค์ ํ ์ ์์ต๋๋ค. ์ํ๋ ๊ฒฐ๊ณผ๊ฐ ๋์ค์ง ์๋๋ค๋ฉด ์์ฑ ๋ฒํผ์ ๋ค์ ๋๋ฌ๋ณด์ธ์.")
|
39 |
|
40 |
+
# ํ๊ต๊ธ ์ ํ
|
41 |
school_level = st.radio("ํ๊ต๊ธ ์ ํ", ["์ด๋ฑํ๊ต", "์คยท๊ณ ๋ฑํ๊ต"])
|
42 |
|
43 |
+
# ์คยท๊ณ ๋ฑํ๊ต ์ ํ ์ ์ถ๊ฐ ์
๋ ฅ ํ๋
|
44 |
subjects = None
|
45 |
major = None
|
46 |
if school_level == "์คยท๊ณ ๋ฑํ๊ต":
|
|
|
49 |
subjects = st.multiselect("๊ต๊ณผ๋ชฉ ์ ํ", subject_options)
|
50 |
major = st.text_input("ํฌ๋ง์ ๊ณต")
|
51 |
|
52 |
+
# ํค์๋ ๋ชฉ๋ก
|
53 |
attitude_keywords = [
|
54 |
"์ง์ค๋ ฅ", "๊ณผ์ ์ดํด", "๋ฐํ", "๋ฌธ์ ํด๊ฒฐ๋ ฅ", "๊ณผ์ ์ํ", "๊ด์ฐฐ๋ ฅ",
|
55 |
"ํ๊ตฌ๋ ฅ", "์๊ธฐ ์๊ฐ ํํ", "๋
ผ๋ฆฌ์ ์ฌ๊ณ ๋ ฅ", "์ด๋์ ๊ฒฝ", "ํ๋์ฌ",
|
|
|
73 |
"๋ฏธ์", "์ฌ์น", "์ ๋จธ", "์ต์ธํจ", "์ฐ์ธํจ", "๋ถ์ ์ "
|
74 |
]
|
75 |
|
76 |
+
# ์ปฌ๋ผ ์์ฑ
|
77 |
col1, col2 = st.columns(2)
|
78 |
|
79 |
with col1:
|