820nam commited on
Commit
4e47ea7
Β·
verified Β·
1 Parent(s): e86145a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -58,7 +58,7 @@ def classify_political_sentiment(text, classifier):
58
  return "보수", sentiment_score
59
  else:
60
  return "쀑립", sentiment_score
61
-
62
  # Step 5: λ‰΄μŠ€ 뢄석 및 κ²°κ³Ό 좜λ ₯
63
  def analyze_news_political_orientation(news_items, classifier, translator):
64
  results = {"진보": 0, "보수": 0, "쀑립": 0}
@@ -85,6 +85,7 @@ def analyze_news_political_orientation(news_items, classifier, translator):
85
 
86
  return results, detailed_results
87
 
 
88
  # Streamlit μ•± μ‹œμž‘
89
  st.title("μ •μΉ˜ μ„±ν–₯ 뢄석 λŒ€μ‹œλ³΄λ“œ")
90
  st.markdown("### 넀이버 λ‰΄μŠ€ 데이터λ₯Ό μ‹€μ‹œκ°„μœΌλ‘œ μˆ˜μ§‘ν•˜κ³  μ •μΉ˜ μ„±ν–₯을 λΆ„μ„ν•©λ‹ˆλ‹€.")
@@ -92,7 +93,6 @@ st.markdown("### 넀이버 λ‰΄μŠ€ 데이터λ₯Ό μ‹€μ‹œκ°„μœΌλ‘œ μˆ˜μ§‘ν•˜κ³  μ •
92
  # 검색 ν‚€μ›Œλ“œ μž…λ ₯
93
  query = st.text_input("검색 ν‚€μ›Œλ“œλ₯Ό μž…λ ₯ν•˜μ„Έμš”", value="μ •μΉ˜")
94
 
95
- # 뢄석 μ‹œμž‘ λ²„νŠΌ 클릭 μ‹œ λ™μž‘
96
  if st.button("뢄석 μ‹œμž‘"):
97
  with st.spinner("데이터λ₯Ό 뢄석 μ€‘μž…λ‹ˆλ‹€..."):
98
  try:
@@ -102,7 +102,7 @@ if st.button("뢄석 μ‹œμž‘"):
102
  # 데이터 μˆ˜μ§‘λœ μƒνƒœ 확인
103
  if not news_data or not news_data.get("items"):
104
  st.error("λ‰΄μŠ€ 데이터λ₯Ό λΆˆλŸ¬μ˜€λŠ” 데 μ‹€νŒ¨ν–ˆμŠ΅λ‹ˆλ‹€.")
105
- return # return을 μ‚­μ œν•˜κ³ , 였λ₯˜ λ©”μ‹œμ§€λ‘œ λŒ€μ²΄
106
 
107
  news_items = news_data["items"]
108
 
 
58
  return "보수", sentiment_score
59
  else:
60
  return "쀑립", sentiment_score
61
+
62
  # Step 5: λ‰΄μŠ€ 뢄석 및 κ²°κ³Ό 좜λ ₯
63
  def analyze_news_political_orientation(news_items, classifier, translator):
64
  results = {"진보": 0, "보수": 0, "쀑립": 0}
 
85
 
86
  return results, detailed_results
87
 
88
+
89
  # Streamlit μ•± μ‹œμž‘
90
  st.title("μ •μΉ˜ μ„±ν–₯ 뢄석 λŒ€μ‹œλ³΄λ“œ")
91
  st.markdown("### 넀이버 λ‰΄μŠ€ 데이터λ₯Ό μ‹€μ‹œκ°„μœΌλ‘œ μˆ˜μ§‘ν•˜κ³  μ •μΉ˜ μ„±ν–₯을 λΆ„μ„ν•©λ‹ˆλ‹€.")
 
93
  # 검색 ν‚€μ›Œλ“œ μž…λ ₯
94
  query = st.text_input("검색 ν‚€μ›Œλ“œλ₯Ό μž…λ ₯ν•˜μ„Έμš”", value="μ •μΉ˜")
95
 
 
96
  if st.button("뢄석 μ‹œμž‘"):
97
  with st.spinner("데이터λ₯Ό 뢄석 μ€‘μž…λ‹ˆλ‹€..."):
98
  try:
 
102
  # 데이터 μˆ˜μ§‘λœ μƒνƒœ 확인
103
  if not news_data or not news_data.get("items"):
104
  st.error("λ‰΄μŠ€ 데이터λ₯Ό λΆˆλŸ¬μ˜€λŠ” 데 μ‹€νŒ¨ν–ˆμŠ΅λ‹ˆλ‹€.")
105
+ return # 였λ₯˜ λ°œμƒ μ‹œ, return을 λŒ€μ‹ ν•˜μ—¬ 였λ₯˜λ₯Ό λ³΄μ—¬μ€λ‹ˆλ‹€.
106
 
107
  news_items = news_data["items"]
108