shravya commited on
Commit
cb12976
·
1 Parent(s): 1e80d50

resolved comments

Browse files
Files changed (5) hide show
  1. app.py +2 -10
  2. main.css +41 -0
  3. main.py +42 -79
  4. research_paper.py +0 -1
  5. test.py +0 -8
app.py CHANGED
@@ -1,14 +1,11 @@
1
  from dotenv import load_dotenv
2
- load_dotenv()
3
-
4
  import json
5
  import streamlit as st
6
-
7
  import utils.settings as settings
8
 
9
  from crew.article_suggestion import article_recommendation_crew
10
  from utils.write_to_json import write_dict_to_json as write_dict_to_json
11
-
12
  settings.init()
13
 
14
 
@@ -20,9 +17,6 @@ def icon(emoji: str):
20
  )
21
 
22
 
23
- # st.set_page_config(layout="wide")
24
-
25
-
26
  def main():
27
  icon("📖 Articles RecommendAIgent")
28
  st.subheader("Let AI agents recommend articles based on your interest!")
@@ -55,7 +49,7 @@ def main():
55
  "Disadvantages of Quantization: Less precise.\n\n",
56
  height=400,
57
  )
58
- st.markdown("") # Adding a blank space here
59
  submitted = st.form_submit_button("Submit")
60
 
61
  if submitted:
@@ -77,8 +71,6 @@ def main():
77
 
78
  st.subheader("", anchor=False, divider="rainbow")
79
 
80
- # json_data = json.loads(result)
81
- # articles_list = json_data.get("articles", None)
82
  articles_list = settings.articles.values()
83
 
84
  if articles_list is None:
 
1
  from dotenv import load_dotenv
 
 
2
  import json
3
  import streamlit as st
 
4
  import utils.settings as settings
5
 
6
  from crew.article_suggestion import article_recommendation_crew
7
  from utils.write_to_json import write_dict_to_json as write_dict_to_json
8
+ load_dotenv()
9
  settings.init()
10
 
11
 
 
17
  )
18
 
19
 
 
 
 
20
  def main():
21
  icon("📖 Articles RecommendAIgent")
22
  st.subheader("Let AI agents recommend articles based on your interest!")
 
49
  "Disadvantages of Quantization: Less precise.\n\n",
50
  height=400,
51
  )
52
+ st.markdown("")
53
  submitted = st.form_submit_button("Submit")
54
 
55
  if submitted:
 
71
 
72
  st.subheader("", anchor=False, divider="rainbow")
73
 
 
 
74
  articles_list = settings.articles.values()
75
 
76
  if articles_list is None:
main.css ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body {
2
+ background-color: white;
3
+ color: #333;
4
+ font-family: 'Arial', sans-serif;
5
+ margin: 0;
6
+ padding: 0;
7
+ }
8
+ .main-title {
9
+ font-size: 3em;
10
+ font-weight: bold;
11
+ margin-top: 20px;
12
+ text-align: center;
13
+ color: #007bff;
14
+ }
15
+ .sub-header {
16
+ font-size: 1.5em;
17
+ margin: 20px 0;
18
+ text-align: center;
19
+ color: #333;
20
+ }
21
+ .card {
22
+ background-color: #f8f9fa;
23
+ border-radius: 10px;
24
+ padding: 20px;
25
+ margin: 20px;
26
+ height:300px;
27
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
28
+ display: flex;
29
+ flex-direction: column;
30
+ justify-content: center;
31
+ align-items: center;
32
+ text-align: center;
33
+ }
34
+ .card h2 {
35
+ font-size: 1.5em;
36
+ color: #007bff;
37
+ }
38
+ .card p {
39
+ color: #666;
40
+ }
41
+
main.py CHANGED
@@ -1,15 +1,22 @@
1
  import streamlit as st
2
  from dotenv import load_dotenv
3
- load_dotenv()
4
  from streamlit_extras.stylable_container import stylable_container
5
-
6
  from app import main as article_recommendor_main
7
  from research_paper import main as research_article_suggester_main
8
  from test import main as feedback_main
9
 
 
 
 
10
  st.set_page_config(page_title='Multi-Page App', page_icon='📰', layout='wide')
11
 
 
 
 
 
12
  def main():
 
13
  if 'page' not in st.session_state:
14
  st.session_state.page = "main"
15
 
@@ -23,49 +30,9 @@ def main():
23
  feedback_main()
24
 
25
  def show_main_page():
26
- st.markdown(
27
- """
28
- <style>
29
- body {
30
- background-color: #2e2e2e;
31
- background-size: cover;
32
- background-position: center;
33
- background-repeat: no-repeat;
34
- }
35
- .main-title {
36
- font-size: 3em;
37
- font-weight: bold;
38
- margin-top: 20px;
39
- text-align: center;
40
- }
41
- .sub-header {
42
- font-size: 1.5em;
43
- margin: 20px 0;
44
- text-align: center;
45
- }
46
- .card {
47
-
48
- border-radius: 10px;
49
- padding: 20px;
50
- width: 300px;
51
- height: 300px;
52
- text-align: center;
53
- margin: 20px;
54
- }
55
- .card-button {
56
- background-color: #ff4b4b;
57
- color: white;
58
- border: none;
59
- padding: 10px 20px;
60
- font-size: 1em;
61
- border-radius: 5px;
62
- cursor: pointer;
63
- }
64
- .card-button:hover {
65
- background-color: #ff7979;
66
- }
67
- </style>
68
- """, unsafe_allow_html=True)
69
 
70
  st.markdown('<div class="main-title">Welcome to the Multi-Page App!</div>', unsafe_allow_html=True)
71
  st.markdown("---")
@@ -75,8 +42,6 @@ def show_main_page():
75
  {"title": "Article Recommendor", "description": "Discover articles tailored to your interests.", "key": "article_recommendor"},
76
  {"title": "Recent Article Suggester", "description": "Get suggestions for recent research articles.", "key": "research_article_suggester"},
77
  {"title": "Feedback", "description": "Provide your valuable feedback.", "key": "feedback"},
78
-
79
-
80
  ]
81
 
82
  num_cols = 3
@@ -87,44 +52,42 @@ def show_main_page():
87
  css_styles="""
88
  {
89
  display: flex;
90
- # justify-content: center;
91
  align-items: center;
92
  flex-wrap: wrap;
93
  }
94
  """,
95
  ):
96
-
97
  for row in range(num_rows):
98
- cols = st.columns(num_cols)
99
- for col in range(num_cols):
100
- index = row * num_cols + col
101
- if index < len(card_info):
102
- card = card_info[index]
103
- with cols[col]:
104
- with stylable_container(
105
- key="inside_container_with_border",
106
- css_styles="""
107
- {
108
- border-radius: 10px;
109
- box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
110
- align-items: center;
111
- flex-wrap: wrap;
112
- padding:10px;
113
- }
114
- """,
115
- ):
116
- st.markdown(
117
- f'''
118
- <div class="card">
119
- <h2>{card["title"]}</h2>
120
- <p>{card["description"]}</p>
121
-
122
- </div>
123
- ''', unsafe_allow_html=True)
124
-
125
- if st.button(f"Go to {card['title']}", key=card["key"]):
126
- st.session_state.page = card["key"]
 
127
 
128
-
129
  if __name__ == '__main__':
130
  main()
 
1
  import streamlit as st
2
  from dotenv import load_dotenv
 
3
  from streamlit_extras.stylable_container import stylable_container
4
+ from PIL import Image
5
  from app import main as article_recommendor_main
6
  from research_paper import main as research_article_suggester_main
7
  from test import main as feedback_main
8
 
9
+ load_dotenv()
10
+
11
+
12
  st.set_page_config(page_title='Multi-Page App', page_icon='📰', layout='wide')
13
 
14
+ def load_css(file_name):
15
+ with open(file_name) as f:
16
+ return f.read()
17
+
18
  def main():
19
+
20
  if 'page' not in st.session_state:
21
  st.session_state.page = "main"
22
 
 
30
  feedback_main()
31
 
32
  def show_main_page():
33
+
34
+ css = load_css("main.css")
35
+ st.markdown(f"<style>{css}</style>", unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  st.markdown('<div class="main-title">Welcome to the Multi-Page App!</div>', unsafe_allow_html=True)
38
  st.markdown("---")
 
42
  {"title": "Article Recommendor", "description": "Discover articles tailored to your interests.", "key": "article_recommendor"},
43
  {"title": "Recent Article Suggester", "description": "Get suggestions for recent research articles.", "key": "research_article_suggester"},
44
  {"title": "Feedback", "description": "Provide your valuable feedback.", "key": "feedback"},
 
 
45
  ]
46
 
47
  num_cols = 3
 
52
  css_styles="""
53
  {
54
  display: flex;
 
55
  align-items: center;
56
  flex-wrap: wrap;
57
  }
58
  """,
59
  ):
 
60
  for row in range(num_rows):
61
+ cols = st.columns(num_cols)
62
+ for col in range(num_cols):
63
+ index = row * num_cols + col
64
+ if index < len(card_info):
65
+ card = card_info[index]
66
+ with cols[col]:
67
+ with stylable_container(
68
+ key="inside_container_with_border",
69
+ css_styles="""
70
+ {
71
+ height: 500px;
72
+ background-color: #f8f9fa;
73
+ border-radius: 10px;
74
+ box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
75
+ display: flex;
76
+ justify-content: center;
77
+ align-items: center;
78
+ flex-wrap: wrap;
79
+ padding:10px;
80
+ """,
81
+ ):
82
+ st.markdown(
83
+ f'''
84
+ <div class="card">
85
+ <h2>{card["title"]}</h2>
86
+ <p>{card["description"]}</p>
87
+ </div>
88
+ ''', unsafe_allow_html=True)
89
+ if st.button(f"Go to {card['title']}", key=card["key"]):
90
+ st.session_state.page = card["key"]
91
 
 
92
  if __name__ == '__main__':
93
  main()
research_paper.py CHANGED
@@ -3,7 +3,6 @@ from crew.research_article_suggester import RecentArticleSuggester
3
  from streamlit_extras.capture import stdout
4
 
5
 
6
- # st.set_page_config(page_title='Recent Article Suggester', page_icon='📰', layout='wide')
7
 
8
  def main():
9
 
 
3
  from streamlit_extras.capture import stdout
4
 
5
 
 
6
 
7
  def main():
8
 
test.py CHANGED
@@ -5,16 +5,8 @@ from crew.til import TilCrew
5
  import streamlit as st
6
  from streamlit_extras.capture import stdout
7
 
8
- # crew = TilCrew()
9
- # results = crew.kickoff(inputs={"content": "Today I learnt Sidecar pattern"})
10
- # results = crew.kickoff(inputs={"content": "Learnt about go-lang routines to add concurrency in the React App."})
11
- # results = crew.kickoff(inputs={"content": "Upon delving into the intricacies of Docker, I have acquired the capability to encapsulate our application within containers, thereby streamlining the deployment process across a multitude of heterogeneous environments."})
12
- # print(results)
13
-
14
 
15
  def main():
16
- # st.set_page_config(page_title='Today I Learnt',
17
- # page_icon='📰', layout='wide')
18
  st.markdown("<div class='container'>", unsafe_allow_html=True)
19
 
20
  st.markdown(
 
5
  import streamlit as st
6
  from streamlit_extras.capture import stdout
7
 
 
 
 
 
 
 
8
 
9
  def main():
 
 
10
  st.markdown("<div class='container'>", unsafe_allow_html=True)
11
 
12
  st.markdown(