seawolf2357 commited on
Commit
daebf37
β€’
1 Parent(s): e16dfc5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
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
- # μ΅œμ‹  OpenAI APIλ₯Ό μ‚¬μš©ν•˜μ—¬ ν…μŠ€νŠΈ μ™„μ„± μš”μ²­
11
  response = openai.Completion.create(
12
- model="gpt-3.5-turbo", # μ‚¬μš© κ°€λŠ₯ν•œ GPT-3 λͺ¨λΈ
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()