Update app.py
Browse files
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'] = '
|
30 |
matplotlib.rcParams['axes.unicode_minus'] = False # ๋ง์ด๋์ค ๊ธฐํธ ๊นจ์ง ๋ฐฉ์ง
|
31 |
|
32 |
# ๋ค์ด๋ฒ ๋ด์ค API๋ฅผ ํตํด ์ค์ ๋ด์ค ๊ธฐ์ฌ ๊ฐ์ ธ์ค๊ธฐ
|
@@ -69,7 +69,7 @@ def generate_article_gpt4(prompt):
|
|
69 |
{"role": "system", "content": "You are a helpful assistant that generates articles."},
|
70 |
{"role": "user", "content": prompt} # ์ฌ์ฉ์๊ฐ ์ ๊ณตํ ํ๋กฌํํธ
|
71 |
],
|
72 |
-
max_tokens=1024, #
|
73 |
temperature=0.7 # ์ฐฝ์์ฑ ์ ๋
|
74 |
)
|
75 |
return response['choices'][0]['message']['content'] # GPT์ ์๋ต ํ
์คํธ ๋ฐํ
|
@@ -133,11 +133,13 @@ def visualize_sentiment_distribution(sentiment_counts):
|
|
133 |
labels = list(sentiment_counts.keys())
|
134 |
sizes = list(sentiment_counts.values())
|
135 |
|
136 |
-
#
|
137 |
-
|
138 |
-
|
139 |
-
ax.
|
140 |
-
ax.
|
|
|
|
|
141 |
st.pyplot(fig)
|
142 |
|
143 |
# Streamlit ์ ํ๋ฆฌ์ผ์ด์
|
|
|
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๋ฅผ ํตํด ์ค์ ๋ด์ค ๊ธฐ์ฌ ๊ฐ์ ธ์ค๊ธฐ
|
|
|
69 |
{"role": "system", "content": "You are a helpful assistant that generates articles."},
|
70 |
{"role": "user", "content": prompt} # ์ฌ์ฉ์๊ฐ ์ ๊ณตํ ํ๋กฌํํธ
|
71 |
],
|
72 |
+
max_tokens=1024, # ๊ธ์ ์ ์ ํ ํด์ (์ต๋ 1024 ํ ํฐ)
|
73 |
temperature=0.7 # ์ฐฝ์์ฑ ์ ๋
|
74 |
)
|
75 |
return response['choices'][0]['message']['content'] # GPT์ ์๋ต ํ
์คํธ ๋ฐํ
|
|
|
133 |
labels = list(sentiment_counts.keys())
|
134 |
sizes = list(sentiment_counts.values())
|
135 |
|
136 |
+
# ์์ ์ค์ (๋ถ๋๋ฌ์ด ํ๋ ํธ)
|
137 |
+
color_palette = sns.color_palette("pastel")[0:len(sizes)]
|
138 |
+
|
139 |
+
ax.bar(labels, sizes, color=color_palette)
|
140 |
+
ax.set_xlabel('์ฑํฅ', fontsize=14)
|
141 |
+
ax.set_ylabel('๊ฑด์', fontsize=14)
|
142 |
+
ax.set_title('๋ด์ค ์ฑํฅ ๋ถํฌ', fontsize=16)
|
143 |
st.pyplot(fig)
|
144 |
|
145 |
# Streamlit ์ ํ๋ฆฌ์ผ์ด์
|