KYTHY commited on
Commit
5040ebe
·
verified ·
1 Parent(s): f77405e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -18
app.py CHANGED
@@ -2,10 +2,6 @@ import streamlit as st
2
  import requests
3
  import pandas as pd
4
  from datetime import datetime, timedelta
5
- # import nltk
6
- # from wordcloud import WordCloud
7
- # import base64
8
- # from io import BytesIO
9
  import numpy as np
10
  from sklearn.linear_model import LinearRegression
11
  import plotly.graph_objects as go
@@ -57,14 +53,6 @@ def analyze_text(text):
57
  return float(score)
58
 
59
 
60
- # def generate_wordcloud(text):
61
- # stopwords = nltk.corpus.stopwords.words('english')
62
- # wordcloud = WordCloud(width=800, height=400, background_color="white", stopwords=stopwords).generate(text)
63
- # buf = BytesIO()
64
- # wordcloud.to_image().save(buf, format="PNG")
65
- # return base64.b64encode(buf.getvalue()).decode()
66
-
67
-
68
  # --------------------------
69
  # แปลงชื่อ/ตัวย่อ → (Company Name, Symbol)
70
  # --------------------------
@@ -208,11 +196,6 @@ def main():
208
  col2.metric("ข่าวเชิงบวก", f"{pos_pct:.1f}%")
209
  col3.metric("ข่าวเชิงลบ", f"{neg_pct:.1f}%")
210
 
211
- # # WordCloud
212
- # st.subheader("☁️ Word Cloud")
213
- # all_text = " ".join(news_df["text"].tolist())
214
- # img = generate_wordcloud(all_text)
215
- # st.image(f"data:image/png;base64,{img}", use_column_width=True)
216
 
217
  # ---------------------------------------------------------
218
  # เตรียมข้อมูลสำหรับกราฟ Sentiment & Price
@@ -383,5 +366,4 @@ def main():
383
  # RUN APP
384
  # ---------------------------------------------------------
385
  if __name__ == "__main__":
386
- # nltk.download("stopwords", quiet=True)
387
  main()
 
2
  import requests
3
  import pandas as pd
4
  from datetime import datetime, timedelta
 
 
 
 
5
  import numpy as np
6
  from sklearn.linear_model import LinearRegression
7
  import plotly.graph_objects as go
 
53
  return float(score)
54
 
55
 
 
 
 
 
 
 
 
 
56
  # --------------------------
57
  # แปลงชื่อ/ตัวย่อ → (Company Name, Symbol)
58
  # --------------------------
 
196
  col2.metric("ข่าวเชิงบวก", f"{pos_pct:.1f}%")
197
  col3.metric("ข่าวเชิงลบ", f"{neg_pct:.1f}%")
198
 
 
 
 
 
 
199
 
200
  # ---------------------------------------------------------
201
  # เตรียมข้อมูลสำหรับกราฟ Sentiment & Price
 
366
  # RUN APP
367
  # ---------------------------------------------------------
368
  if __name__ == "__main__":
 
369
  main()