820nam commited on
Commit
0f0bb0d
ยท
verified ยท
1 Parent(s): 7916a48

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -24,9 +24,9 @@ st.markdown(
24
  unsafe_allow_html=True
25
  )
26
 
27
- # matplotlib ํ•œ๊ธ€ ํฐํŠธ ์„ค์ •
28
  import matplotlib
29
- matplotlib.rcParams['font.family'] = 'NanumGothic' # ํ•œ๊ธ€ ํฐํŠธ๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
30
  matplotlib.rcParams['axes.unicode_minus'] = False # ๋งˆ์ด๋„ˆ์Šค ๊ธฐํ˜ธ ๊นจ์ง ๋ฐฉ์ง€
31
 
32
  # ๋„ค์ด๋ฒ„ ๋‰ด์Šค API๋ฅผ ํ†ตํ•ด ์‹ค์ œ ๋‰ด์Šค ๊ธฐ์‚ฌ ๊ฐ€์ ธ์˜ค๊ธฐ
@@ -65,7 +65,7 @@ def generate_article_gpt4(prompt):
65
  # GPT-4 ๋ชจ๋ธ์„ ์ด์šฉํ•ด ๋ฐ˜๋Œ€ ๊ด€์  ๊ธฐ์‚ฌ๋ฅผ ์ƒ์„ฑ
66
  response = openai.ChatCompletion.create(
67
  model="gpt-4", # GPT-4 ๋ชจ๋ธ์„ ์‚ฌ์šฉ
68
- messages=[
69
  {"role": "system", "content": "You are a helpful assistant that generates articles."},
70
  {"role": "user", "content": prompt} # ์‚ฌ์šฉ์ž๊ฐ€ ์ œ๊ณตํ•œ ํ”„๋กฌํ”„ํŠธ
71
  ],
@@ -167,8 +167,4 @@ if st.button("๐Ÿ” ๋ถ„์„ ์‹œ์ž‘"):
167
  st.write(f"#### {result['์ œ๋ชฉ']}")
168
  st.write(f"- **์›๋ณธ ๊ธฐ์‚ฌ**: {result['์›๋ณธ ๊ธฐ์‚ฌ']}")
169
  st.write(f"- **์„ฑํ–ฅ**: {result['์„ฑํ–ฅ']} (์ ์ˆ˜: {result['์„ฑํ–ฅ ์ ์ˆ˜']:.2f})")
170
- st.write(f"- **๋Œ€์กฐ ๊ด€์  ๊ธฐ์‚ฌ**: {result['๋Œ€์กฐ ๊ด€์  ๊ธฐ์‚ฌ']}")
171
- st.write(f"- **๋‰ด์Šค ๋งํฌ**: [๋งํฌ]({result['๋‰ด์Šค ๋งํฌ']})") # ๋งํฌ ์ถœ๋ ฅ
172
- st.write("---")
173
- else:
174
- st.error("๋ถ„์„๋œ ๋‰ด์Šค ๋ฐ์ดํ„ฐ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.")
 
24
  unsafe_allow_html=True
25
  )
26
 
27
+ # matplotlib ํ•œ๊ธ€ ํฐํŠธ ์„ค์ • (๋‹ค๋ฅธ ํฐํŠธ๋ฅผ ์‹œ๋„)
28
  import matplotlib
29
+ matplotlib.rcParams['font.family'] = 'Malgun Gothic' # ํ•œ๊ธ€ ํฐํŠธ๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
30
  matplotlib.rcParams['axes.unicode_minus'] = False # ๋งˆ์ด๋„ˆ์Šค ๊ธฐํ˜ธ ๊นจ์ง ๋ฐฉ์ง€
31
 
32
  # ๋„ค์ด๋ฒ„ ๋‰ด์Šค API๋ฅผ ํ†ตํ•ด ์‹ค์ œ ๋‰ด์Šค ๊ธฐ์‚ฌ ๊ฐ€์ ธ์˜ค๊ธฐ
 
65
  # GPT-4 ๋ชจ๋ธ์„ ์ด์šฉํ•ด ๋ฐ˜๋Œ€ ๊ด€์  ๊ธฐ์‚ฌ๋ฅผ ์ƒ์„ฑ
66
  response = openai.ChatCompletion.create(
67
  model="gpt-4", # GPT-4 ๋ชจ๋ธ์„ ์‚ฌ์šฉ
68
+ messages=[
69
  {"role": "system", "content": "You are a helpful assistant that generates articles."},
70
  {"role": "user", "content": prompt} # ์‚ฌ์šฉ์ž๊ฐ€ ์ œ๊ณตํ•œ ํ”„๋กฌํ”„ํŠธ
71
  ],
 
167
  st.write(f"#### {result['์ œ๋ชฉ']}")
168
  st.write(f"- **์›๋ณธ ๊ธฐ์‚ฌ**: {result['์›๋ณธ ๊ธฐ์‚ฌ']}")
169
  st.write(f"- **์„ฑํ–ฅ**: {result['์„ฑํ–ฅ']} (์ ์ˆ˜: {result['์„ฑํ–ฅ ์ ์ˆ˜']:.2f})")
170
+ st.write(f"- **๋Œ€์กฐ ๊ด€์  ๊ธฐ์‚ฌ**: {result['๋Œ€์กฐ