Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -125,11 +125,13 @@ def get_lunar_info(solYear, solMonth, solDay, solHour):
|
|
125 |
else:
|
126 |
return {"Error": "API νΈμΆμ μ€ν¨νμ΅λλ€."}, "μ 보 μμ", "<p>API νΈμΆμ μ€ν¨νμ΅λλ€.</p>"
|
127 |
|
|
|
|
|
128 |
def analyze_character(lunIljin, OPENAI_API_KEY):
|
129 |
-
API_URL = "https://api.openai.com/v1/chat/completions"
|
130 |
payload = {
|
131 |
-
"model": "gpt-4-0125-preview",
|
132 |
-
"prompt": f"μΌμ£Ό '{lunIljin}'μ λν μ±κ²©κ³Ό νΉμ§μ μ€λͺ
ν΄μ£ΌμΈμ.",
|
133 |
"temperature": 0.7,
|
134 |
"max_tokens": 150,
|
135 |
"top_p": 1.0,
|
@@ -138,7 +140,7 @@ def analyze_character(lunIljin, OPENAI_API_KEY):
|
|
138 |
}
|
139 |
headers = {
|
140 |
"Content-Type": "application/json",
|
141 |
-
"Authorization": f"Bearer {OPENAI_API_KEY}"
|
142 |
}
|
143 |
response = requests.post(API_URL, headers=headers, json=payload)
|
144 |
if response.status_code == 200:
|
@@ -148,7 +150,6 @@ def analyze_character(lunIljin, OPENAI_API_KEY):
|
|
148 |
return f"μ€λ₯κ° λ°μνμ΅λλ€. μν μ½λ: {response.status_code}"
|
149 |
|
150 |
|
151 |
-
|
152 |
# μ¬μ£Ό λΆμ λ°μ΄ν° μμ (κ°μνλ λ²μ )
|
153 |
μ¬μ£Ό_λ°μ΄ν° = {
|
154 |
'κ°μ(η²ε)' : 'μλ‘μ΄ μμμ μμ§, 리λμκ³Ό λ
립μ±μ΄ νΉμ§μ΄λ©°, νΈμΎνκ³ μ±μ€ν νΉμ±μ μ§λλ€. ',
|
|
|
125 |
else:
|
126 |
return {"Error": "API νΈμΆμ μ€ν¨νμ΅λλ€."}, "μ 보 μμ", "<p>API νΈμΆμ μ€ν¨νμ΅λλ€.</p>"
|
127 |
|
128 |
+
|
129 |
+
|
130 |
def analyze_character(lunIljin, OPENAI_API_KEY):
|
131 |
+
API_URL = "https://api.openai.com/v1/chat/completions" # API URLμ΄ μ ννμ§ νμΈ
|
132 |
payload = {
|
133 |
+
"model": "gpt-4-0125-preview", # 'gpt-4-0125-preview' λͺ¨λΈ μ΄λ¦μ΄ μ ννμ§, νΉμ μ¬μ© κ°λ₯νμ§ νμΈ
|
134 |
+
"prompt": f"μΌμ£Ό '{lunIljin}'μ λν μ±κ²©κ³Ό νΉμ§μ μ€λͺ
ν΄μ£ΌμΈμ.", # prompt ꡬμ±μ΄ μ μ νμ§ νμΈ
|
135 |
"temperature": 0.7,
|
136 |
"max_tokens": 150,
|
137 |
"top_p": 1.0,
|
|
|
140 |
}
|
141 |
headers = {
|
142 |
"Content-Type": "application/json",
|
143 |
+
"Authorization": f"Bearer {OPENAI_API_KEY}" # API ν€κ° μ νν μ
λ ₯λμλμ§ νμΈ
|
144 |
}
|
145 |
response = requests.post(API_URL, headers=headers, json=payload)
|
146 |
if response.status_code == 200:
|
|
|
150 |
return f"μ€λ₯κ° λ°μνμ΅λλ€. μν μ½λ: {response.status_code}"
|
151 |
|
152 |
|
|
|
153 |
# μ¬μ£Ό λΆμ λ°μ΄ν° μμ (κ°μνλ λ²μ )
|
154 |
μ¬μ£Ό_λ°μ΄ν° = {
|
155 |
'κ°μ(η²ε)' : 'μλ‘μ΄ μμμ μμ§, 리λμκ³Ό λ
립μ±μ΄ νΉμ§μ΄λ©°, νΈμΎνκ³ μ±μ€ν νΉμ±μ μ§λλ€. ',
|