Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,11 +6,9 @@ from transformers import pipeline
|
|
6 |
import numpy as np
|
7 |
import daal4py as d4p
|
8 |
|
9 |
-
|
10 |
-
|
11 |
# YouTube API setup
|
12 |
def youtube_api_setup():
|
13 |
-
api_key = 'AIzaSyABF3LIJCxwEn8DA2nyTiNa4uCNuaAbn0Q'
|
14 |
youtube = build('youtube', 'v3', developerKey=api_key)
|
15 |
return youtube
|
16 |
|
@@ -61,12 +59,6 @@ def main():
|
|
61 |
|
62 |
# Sentiment analysis
|
63 |
sentiment_model = pipeline("sentiment-analysis")
|
64 |
-
|
65 |
-
# Twitter Sentiment
|
66 |
-
st.subheader("Twitter Sentiment Analysis")
|
67 |
-
client = twitter_api_setup()
|
68 |
-
positive_twitter, negative_twitter = fetch_twitter_sentiment(stock_symbol, client, sentiment_model)
|
69 |
-
st.write(f"Positive Tweets: {positive_twitter}, Negative Tweets: {negative_twitter}")
|
70 |
|
71 |
# YouTube Sentiment
|
72 |
st.subheader("YouTube Sentiment Analysis")
|
@@ -87,8 +79,8 @@ def main():
|
|
87 |
|
88 |
# Recommendation based on sentiment analysis
|
89 |
st.subheader("Stock Recommendation")
|
90 |
-
total_positive =
|
91 |
-
total_negative =
|
92 |
if total_positive > total_negative:
|
93 |
st.write(f"Recommendation: **BUY** {stock_symbol}")
|
94 |
elif total_negative > total_positive:
|
@@ -99,3 +91,4 @@ def main():
|
|
99 |
if __name__ == "__main__":
|
100 |
main()
|
101 |
|
|
|
|
6 |
import numpy as np
|
7 |
import daal4py as d4p
|
8 |
|
|
|
|
|
9 |
# YouTube API setup
|
10 |
def youtube_api_setup():
|
11 |
+
api_key = 'AIzaSyABF3LIJCxwEn8DA2nyTiNa4uCNuaAbn0Q' # Replace with your YouTube API key
|
12 |
youtube = build('youtube', 'v3', developerKey=api_key)
|
13 |
return youtube
|
14 |
|
|
|
59 |
|
60 |
# Sentiment analysis
|
61 |
sentiment_model = pipeline("sentiment-analysis")
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
# YouTube Sentiment
|
64 |
st.subheader("YouTube Sentiment Analysis")
|
|
|
79 |
|
80 |
# Recommendation based on sentiment analysis
|
81 |
st.subheader("Stock Recommendation")
|
82 |
+
total_positive = positive_youtube
|
83 |
+
total_negative = negative_youtube
|
84 |
if total_positive > total_negative:
|
85 |
st.write(f"Recommendation: **BUY** {stock_symbol}")
|
86 |
elif total_negative > total_positive:
|
|
|
91 |
if __name__ == "__main__":
|
92 |
main()
|
93 |
|
94 |
+
|