Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -21,20 +21,25 @@ def upload_and_process_file():
|
|
21 |
return None
|
22 |
|
23 |
# 생활기록부 문구 생성 함수
|
24 |
-
def generate_living_record(data, selected_instruction):
|
25 |
data_str = str(data)
|
26 |
-
instruction_content = (instructions.instruction if selected_instruction == "초등학교"
|
27 |
-
else instructions.highschool_instruction)
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
response = openai.ChatCompletion.create(
|
30 |
model="gpt-4o-mini",
|
31 |
messages=[
|
32 |
-
{"role": "system",
|
33 |
-
|
34 |
-
},
|
35 |
-
{"role": "user",
|
36 |
-
"content": data_str
|
37 |
-
}
|
38 |
],
|
39 |
temperature=0.7,
|
40 |
max_tokens=10000,
|
|
|
21 |
return None
|
22 |
|
23 |
# 생활기록부 문구 생성 함수
|
24 |
+
def generate_living_record(data, selected_instruction, subjects=None, major=None):
|
25 |
data_str = str(data)
|
|
|
|
|
26 |
|
27 |
+
if selected_instruction == "중·고등학교" and subjects and major:
|
28 |
+
# 선택된 교과목들을 문자열로 변환
|
29 |
+
subjects_str = ", ".join(subjects)
|
30 |
+
# instruction 문자열 포매팅
|
31 |
+
instruction_text = instructions.highschool_instruction.format(
|
32 |
+
subjects=subjects_str,
|
33 |
+
major=major
|
34 |
+
)
|
35 |
+
else:
|
36 |
+
instruction_text = instructions.instruction
|
37 |
+
|
38 |
response = openai.ChatCompletion.create(
|
39 |
model="gpt-4o-mini",
|
40 |
messages=[
|
41 |
+
{"role": "system", "content": instruction_text},
|
42 |
+
{"role": "user", "content": data_str}
|
|
|
|
|
|
|
|
|
43 |
],
|
44 |
temperature=0.7,
|
45 |
max_tokens=10000,
|