Spaces:
Sleeping
Sleeping
seawolf2357
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -7,9 +7,9 @@ openai.api_key = os.getenv("OPENAI_API_KEY")
|
|
7 |
|
8 |
def generate_keyword_from_text(input_text):
|
9 |
try:
|
10 |
-
#
|
11 |
response = openai.Completion.create(
|
12 |
-
model="
|
13 |
prompt=f"λ€μ ν
μ€νΈμ λν Pexels κ²μμ μν μλ¬Έ ν€μλ μμ±: '{input_text}'",
|
14 |
temperature=0.5,
|
15 |
max_tokens=10
|
@@ -20,7 +20,7 @@ def generate_keyword_from_text(input_text):
|
|
20 |
print(f"μλ¬ λ°μ: {e}")
|
21 |
return "ν€μλ μμ± μ€ μλ¬ λ°μ"
|
22 |
|
23 |
-
# Gradio μΈν°νμ΄μ€ μ€μ κ³Ό μ€ν
|
24 |
iface = gr.Interface(
|
25 |
fn=generate_keyword_from_text,
|
26 |
inputs=gr.Textbox(lines=2, label="ν
μ€νΈ μ
λ ₯"),
|
|
|
7 |
|
8 |
def generate_keyword_from_text(input_text):
|
9 |
try:
|
10 |
+
# μ΅μ OpenAI APIλ₯Ό μ¬μ©νμ¬ ν
μ€νΈ μμ± μμ²
|
11 |
response = openai.Completion.create(
|
12 |
+
model="gpt-3.5-turbo", # μ¬μ© κ°λ₯ν μ΅μ GPT λͺ¨λΈ μ¬μ©
|
13 |
prompt=f"λ€μ ν
μ€νΈμ λν Pexels κ²μμ μν μλ¬Έ ν€μλ μμ±: '{input_text}'",
|
14 |
temperature=0.5,
|
15 |
max_tokens=10
|
|
|
20 |
print(f"μλ¬ λ°μ: {e}")
|
21 |
return "ν€μλ μμ± μ€ μλ¬ λ°μ"
|
22 |
|
23 |
+
# Gradio μΈν°νμ΄μ€ μ€μ κ³Ό μ€ν
|
24 |
iface = gr.Interface(
|
25 |
fn=generate_keyword_from_text,
|
26 |
inputs=gr.Textbox(lines=2, label="ν
μ€νΈ μ
λ ₯"),
|