Spaces:
Sleeping
Sleeping
seawolf2357
commited on
Commit
β’
daebf37
1
Parent(s):
e16dfc5
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,9 +20,7 @@ def generate_keyword_from_text(input_text):
|
|
20 |
print(f"μλ¬ λ°μ: {e}")
|
21 |
return "ν€μλ μμ± μ€ μλ¬ λ°μ"
|
22 |
|
23 |
-
# Gradio μΈν°νμ΄μ€
|
24 |
-
import gradio as gr
|
25 |
-
|
26 |
iface = gr.Interface(
|
27 |
fn=generate_keyword_from_text,
|
28 |
inputs=gr.Textbox(lines=2, label="ν
μ€νΈ μ
λ ₯"),
|
@@ -31,5 +29,4 @@ iface = gr.Interface(
|
|
31 |
description="μ 곡λ ν
μ€νΈλ₯Ό λ°νμΌλ‘ Pexels κ²μμ μ¬μ©ν μλ¬Έ ν€μλλ₯Ό μλ μμ±ν©λλ€."
|
32 |
)
|
33 |
|
34 |
-
|
35 |
-
iface.launch()
|
|
|
7 |
|
8 |
def generate_keyword_from_text(input_text):
|
9 |
try:
|
10 |
+
# chat λͺ¨λΈμ΄ μλ μΌλ° ν
μ€νΈ μμ± λͺ¨λΈμ μ¬μ©
|
11 |
response = openai.Completion.create(
|
12 |
+
model="text-davinci-003", # μμ λ GPT-3 λͺ¨λΈ
|
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="ν
μ€νΈ μ
λ ₯"),
|
|
|
29 |
description="μ 곡λ ν
μ€νΈλ₯Ό λ°νμΌλ‘ Pexels κ²μμ μ¬μ©ν μλ¬Έ ν€μλλ₯Ό μλ μμ±ν©λλ€."
|
30 |
)
|
31 |
|
32 |
+
iface.launch()
|
|