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,
|