MarieGotthardt commited on
Commit
5a1e68a
·
1 Parent(s): d7a183e

got most positive article from hopsworks

Browse files
Files changed (1) hide show
  1. app.py +16 -9
app.py CHANGED
@@ -1,24 +1,31 @@
1
  import gradio as gr
2
  import PIL
3
  import hopsworks
 
 
 
 
4
 
5
  project = hopsworks.login()
6
- # fs = project.get_feature_store()
 
 
 
 
 
 
7
 
 
 
8
  dataset_api = project.get_dataset_api()
9
 
10
  dataset_api.download("Resources/images/news_image.png")
11
  dataset_api.download("Resources/images/general_sentiment_history.png")
12
  dataset_api.download("Resources/images/demo_sentiment_history.png")
13
 
14
- news_headline = "Lucia celebration at KTH Library"
15
- news_source = "KTH Library"
16
- news_article = """This year Akademiska hus and KTH Library invites you to a warm and beautiful Lucia celebration in the library hall. We will get to listen to Kongliga Teknologkören (KTH choir) singing traditional Lucia hymns.
17
-
18
- We will also offer traditional Lucia fika, mainly mulled wine (alcohol free), "lussebullar" and ginger bread cookies.
19
-
20
- The Lucia celebration starts 7:30 in the morning. You are welcome to enter the library from 6:50. Please note that this is a popular event that may reach full capacity! First come, first served.
21
- """
22
 
23
  with gr.Blocks() as demo:
24
  gr.Markdown("<div align='center'><h1>The Delight Dispatch ☀️🗞️</h1></div")
 
1
  import gradio as gr
2
  import PIL
3
  import hopsworks
4
+ import pandas as pd
5
+ from datetime import datetime
6
+
7
+ today = datetime.now().strftime('%Y-%m-%d')
8
 
9
  project = hopsworks.login()
10
+ fs = project.get_feature_store()
11
+
12
+ most_positive_fg = fs.get_feature_group(name="articles_most_positive", version=2)
13
+ most_positive_df = most_positive_fg.read()
14
+ most_positive_df = most_positive_df[most_positive_df['pubdate'] == today]
15
+ most_positive_article = most_positive_df.iloc[0]
16
+
17
 
18
+
19
+ # Get images
20
  dataset_api = project.get_dataset_api()
21
 
22
  dataset_api.download("Resources/images/news_image.png")
23
  dataset_api.download("Resources/images/general_sentiment_history.png")
24
  dataset_api.download("Resources/images/demo_sentiment_history.png")
25
 
26
+ news_headline = most_positive_article["title"]
27
+ news_source = most_positive_article["source_id"]
28
+ news_article = most_positive_article["content"]
 
 
 
 
 
29
 
30
  with gr.Blocks() as demo:
31
  gr.Markdown("<div align='center'><h1>The Delight Dispatch ☀️🗞️</h1></div")