Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,7 @@ def load_huggingface_data():
|
|
| 23 |
return dataset
|
| 24 |
|
| 25 |
# ๋ค์ด๋ฒ ๋ด์ค API๋ฅผ ํตํด ๋ด์ค ๋ฐ์ดํฐ ๊ฐ์ ธ์ค๊ธฐ
|
| 26 |
-
def fetch_naver_news(query, display=
|
| 27 |
client_id = "I_8koTJh3R5l4wLurQbG" # ๋ค์ด๋ฒ ๊ฐ๋ฐ์ ์ผํฐ์์ ๋ฐ๊ธ๋ฐ์ Client ID
|
| 28 |
client_secret = "W5oWYlAgur" # ๋ค์ด๋ฒ ๊ฐ๋ฐ์ ์ผํฐ์์ ๋ฐ๊ธ๋ฐ์ Client Secret
|
| 29 |
|
|
@@ -117,11 +117,12 @@ if st.button("๋ฐ์ดํฐ ๊ฒฐํฉ ๋ฐ ํ์ต"):
|
|
| 117 |
|
| 118 |
# ๋ด์ค ๋ฐ์ดํฐ ๋ถ์ ๋ฐ ๋ฐ๋ ๊ด์ ๊ธฐ์ฌ ์์ฑ
|
| 119 |
if st.button("๋ด์ค ์ฑํฅ ๋ถ์"):
|
| 120 |
-
|
| 121 |
-
|
|
|
|
| 122 |
|
| 123 |
if news_items:
|
| 124 |
-
st.subheader("๋ถ์ ๊ฒฐ๊ณผ")
|
| 125 |
for item in news_items:
|
| 126 |
title = item["title"]
|
| 127 |
description = item["description"]
|
|
@@ -143,4 +144,4 @@ if st.button("๋ด์ค ์ฑํฅ ๋ถ์"):
|
|
| 143 |
st.write(f"**์ฑํฅ:** {sentiment}")
|
| 144 |
st.write(f"**๋ฐ๋ ๊ด์ ๊ธฐ์ฌ:** {opposite_article}")
|
| 145 |
st.write(f"**๋งํฌ:** [๊ธฐ์ฌ ๋งํฌ]({link})")
|
| 146 |
-
st.markdown("---")
|
|
|
|
| 23 |
return dataset
|
| 24 |
|
| 25 |
# ๋ค์ด๋ฒ ๋ด์ค API๋ฅผ ํตํด ๋ด์ค ๋ฐ์ดํฐ ๊ฐ์ ธ์ค๊ธฐ
|
| 26 |
+
def fetch_naver_news(query, display=15):
|
| 27 |
client_id = "I_8koTJh3R5l4wLurQbG" # ๋ค์ด๋ฒ ๊ฐ๋ฐ์ ์ผํฐ์์ ๋ฐ๊ธ๋ฐ์ Client ID
|
| 28 |
client_secret = "W5oWYlAgur" # ๋ค์ด๋ฒ ๊ฐ๋ฐ์ ์ผํฐ์์ ๋ฐ๊ธ๋ฐ์ Client Secret
|
| 29 |
|
|
|
|
| 117 |
|
| 118 |
# ๋ด์ค ๋ฐ์ดํฐ ๋ถ์ ๋ฐ ๋ฐ๋ ๊ด์ ๊ธฐ์ฌ ์์ฑ
|
| 119 |
if st.button("๋ด์ค ์ฑํฅ ๋ถ์"):
|
| 120 |
+
# Hugging Face ๋๋ ํ ๋ฆฌ์์ ๋ชจ๋ธ ๋ก๋
|
| 121 |
+
model, vectorizer = load_model_from_huggingface(directory="huggingface_model")
|
| 122 |
+
news_items = fetch_naver_news(query, display=15) # ๋ด์ค 15๊ฐ ๊ฐ์ ธ์ค๊ธฐ
|
| 123 |
|
| 124 |
if news_items:
|
| 125 |
+
st.subheader("๋ด์ค ์ฑํฅ ๋ถ์ ๊ฒฐ๊ณผ")
|
| 126 |
for item in news_items:
|
| 127 |
title = item["title"]
|
| 128 |
description = item["description"]
|
|
|
|
| 144 |
st.write(f"**์ฑํฅ:** {sentiment}")
|
| 145 |
st.write(f"**๋ฐ๋ ๊ด์ ๊ธฐ์ฌ:** {opposite_article}")
|
| 146 |
st.write(f"**๋งํฌ:** [๊ธฐ์ฌ ๋งํฌ]({link})")
|
| 147 |
+
st.markdown("---")
|