Spaces:
Sleeping
Sleeping
seawolf2357
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -7,14 +7,14 @@ openai.api_key = os.getenv("OPENAI_API_KEY")
|
|
7 |
|
8 |
def generate_keyword_from_text(input_text):
|
9 |
try:
|
10 |
-
#
|
11 |
-
response = openai.
|
12 |
-
model="
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
)
|
17 |
-
keyword = response
|
18 |
return keyword
|
19 |
except Exception as e:
|
20 |
print(f"μλ¬ λ°μ: {e}")
|
|
|
7 |
|
8 |
def generate_keyword_from_text(input_text):
|
9 |
try:
|
10 |
+
# OpenAI ChatCompletion μ μ¬μ©νμ¬ μ± λͺ¨λΈ μμ²
|
11 |
+
response = openai.ChatCompletion.create(
|
12 |
+
model="gpt-3.5-turbo",
|
13 |
+
messages=[
|
14 |
+
{"role": "user", "content": f"λ€μ ν
μ€νΈμ λν Pexels κ²μμ μν μλ¬Έ ν€μλ μμ±: '{input_text}'"}
|
15 |
+
]
|
16 |
)
|
17 |
+
keyword = response['choices'][0]['message']['content']
|
18 |
return keyword
|
19 |
except Exception as e:
|
20 |
print(f"μλ¬ λ°μ: {e}")
|