Spaces:
Sleeping
Sleeping
springwater
commited on
Commit
β’
4ce9632
1
Parent(s):
85f4883
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import os
|
|
5 |
import sys
|
6 |
import json
|
7 |
|
|
|
8 |
|
9 |
def exception_handler(exception_type, exception, traceback):
|
10 |
print(f"{exception_type.__name__}: {exception}")
|
@@ -187,7 +188,7 @@ def get_famous_people(lunIljin):
|
|
187 |
return famous_people.get(lunIljin[:2], "ν΄λΉ μΌμ£Όμ λν μ λͺ
μΈ μ λ³΄κ° μμ΅λλ€.")
|
188 |
|
189 |
|
190 |
-
def analyze_character(lunIljin, OPENAI_API_KEY=
|
191 |
API_URL = "https://api.openai.com/v1/chat/completions"
|
192 |
payload = {
|
193 |
"model": "gpt-4-0125-preview", # λͺ¨λΈ μ΄λ¦ νμΈ νμ
|
@@ -212,7 +213,7 @@ def analyze_character(lunIljin, OPENAI_API_KEY="sk-FIY8XdJm4zrEpW27NrRgT3BlbkFJX
|
|
212 |
# μ€λ₯ λ©μμ§ κ°μ
|
213 |
return f"μ€λ₯κ° λ°μνμ΅λλ€. μν μ½λ: {response.status_code}, λ©μμ§: {response.json().get('error', {}).get('message', 'Unknown error')}", ""
|
214 |
|
215 |
-
def analyze_character_two(lunIljin, lunIljin2, OPENAI_API_KEY=
|
216 |
API_URL = "https://api.openai.com/v1/chat/completions"
|
217 |
payload = {
|
218 |
"model": "gpt-4-0125-preview", # λͺ¨λΈ μ΄λ¦ νμΈ νμ
|
|
|
5 |
import sys
|
6 |
import json
|
7 |
|
8 |
+
api_key = os.getenv('API_KEY')
|
9 |
|
10 |
def exception_handler(exception_type, exception, traceback):
|
11 |
print(f"{exception_type.__name__}: {exception}")
|
|
|
188 |
return famous_people.get(lunIljin[:2], "ν΄λΉ μΌμ£Όμ λν μ λͺ
μΈ μ λ³΄κ° μμ΅λλ€.")
|
189 |
|
190 |
|
191 |
+
def analyze_character(lunIljin, OPENAI_API_KEY=api_key):
|
192 |
API_URL = "https://api.openai.com/v1/chat/completions"
|
193 |
payload = {
|
194 |
"model": "gpt-4-0125-preview", # λͺ¨λΈ μ΄λ¦ νμΈ νμ
|
|
|
213 |
# μ€λ₯ λ©μμ§ κ°μ
|
214 |
return f"μ€λ₯κ° λ°μνμ΅λλ€. μν μ½λ: {response.status_code}, λ©μμ§: {response.json().get('error', {}).get('message', 'Unknown error')}", ""
|
215 |
|
216 |
+
def analyze_character_two(lunIljin, lunIljin2, OPENAI_API_KEY=api_key):
|
217 |
API_URL = "https://api.openai.com/v1/chat/completions"
|
218 |
payload = {
|
219 |
"model": "gpt-4-0125-preview", # λͺ¨λΈ μ΄λ¦ νμΈ νμ
|