Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,22 @@ from mentions_dashboard import generate_mentions_dashboard
|
|
9 |
from gradio_utils import get_url_user_token
|
10 |
from Bubble_API_Calls import fetch_linkedin_token_from_bubble
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
def check_token_status(token_state):
|
14 |
return "✅ Token available" if token_state and token_state.get("token") else "❌ Token not available"
|
|
|
9 |
from gradio_utils import get_url_user_token
|
10 |
from Bubble_API_Calls import fetch_linkedin_token_from_bubble
|
11 |
|
12 |
+
from linkedin_data_api_calls import fetch_linkedin_posts, fetch_linkedin_comments, analyze_sentiment, prepare_data_for_bubble, bulk_upload_to_bubble
|
13 |
+
|
14 |
+
# Fetch data
|
15 |
+
posts = fetch_linkedin_posts(client_id, token_dict)
|
16 |
+
comments_data = fetch_linkedin_comments(client_id, token_dict, [post["id"] for post in posts])
|
17 |
+
sentiments = analyze_sentiment(comments_data)
|
18 |
+
|
19 |
+
# Prepare data
|
20 |
+
li_posts, li_post_stats, li_post_comments = prepare_data_for_bubble(posts, sentiments)
|
21 |
+
|
22 |
+
# Upload to Bubble
|
23 |
+
bulk_upload_to_bubble(li_posts, "LI_post")
|
24 |
+
bulk_upload_to_bubble(li_post_stats, "LI_post_stats")
|
25 |
+
bulk_upload_to_bubble(li_post_comments, "LI_post_comments")
|
26 |
+
|
27 |
+
|
28 |
|
29 |
def check_token_status(token_state):
|
30 |
return "✅ Token available" if token_state and token_state.get("token") else "❌ Token not available"
|