shravya commited on
Commit
c327216
·
1 Parent(s): 4014b8f

add styling

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. test.py +128 -3
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  title: ArticleRecommender
3
- app_file: app.py
4
  sdk: streamlit
5
  sdk_version: 1.35.0
6
  pinned: false
 
1
  ---
2
  title: ArticleRecommender
3
+ app_file: test.py
4
  sdk: streamlit
5
  sdk_version: 1.35.0
6
  pinned: false
test.py CHANGED
@@ -1,5 +1,130 @@
 
1
  from crew.research_article_suggester import RecentArticleSuggester
2
 
3
- suggester = RecentArticleSuggester()
4
- results = suggester.kickoff(inputs={"topic": "GenAI"})
5
- print("\nFinal Results: \n\n", results)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
  from crew.research_article_suggester import RecentArticleSuggester
3
 
4
+ def main():
5
+ st.set_page_config(page_title='Recent Article Suggester', page_icon='📰', layout='wide')
6
+
7
+ st.markdown(
8
+ """
9
+ <style>
10
+ .main {
11
+ background-color: #f5f5f5;
12
+ padding: 20px;
13
+ border-radius: 10px;
14
+ }
15
+ .centered {
16
+ display: flex;
17
+ flex-direction: column;
18
+ align-items: center;
19
+ justify-content: center;
20
+ text-align: center;
21
+ }
22
+ .title {
23
+ font-family: 'Helvetica', sans-serif;
24
+ font-weight: bold;
25
+ font-size: 36px;
26
+ color: #1f77b4;
27
+ }
28
+ .description {
29
+ font-family: 'Helvetica', sans-serif;
30
+ font-size: 18px;
31
+ color: #333333;
32
+ margin-top: 10px;
33
+ }
34
+ .subheader {
35
+ font-family: 'Helvetica', sans-serif;
36
+ font-weight: bold;
37
+ font-size: 24px;
38
+ color: #ff7f0e;
39
+ margin-top: 20px;
40
+ }
41
+ .element {
42
+ background-color: #ffffff;
43
+ padding: 1rem;
44
+ border-radius: 8px;
45
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
46
+ margin-bottom: 1rem;
47
+ }
48
+ .element h3 {
49
+ font-size: 24px;
50
+ color: #1f77b4;
51
+ margin-bottom: 0.5rem;
52
+ text-transform: uppercase;
53
+ padding :10px;
54
+
55
+ }
56
+ .element ul {
57
+ list-style-type: none;
58
+ padding: 0;
59
+ margin: 0;
60
+ }
61
+ .element li {
62
+ font-size: 16px;
63
+ color: #333333;
64
+ margin-bottom: 0.5rem;
65
+ }
66
+ .element li b {
67
+ font-size: 22px;
68
+ }
69
+
70
+ </style>
71
+ """,
72
+ unsafe_allow_html=True
73
+ )
74
+
75
+ st.markdown("<div class='container'>", unsafe_allow_html=True)
76
+
77
+ st.markdown(
78
+ """
79
+ <div class="centered">
80
+ <p class="title">Recent Article Suggester</p>
81
+ <p class="description">Discover recent articles based on your topic of interest using advanced AI.</p>
82
+ </div>
83
+ """,
84
+ unsafe_allow_html=True
85
+ )
86
+
87
+ st.sidebar.markdown("<p class='sidebar-header'>Search for the papers you are interested in:</p>", unsafe_allow_html=True)
88
+ topic = st.sidebar.text_input('Enter a topic:', 'GenAI', key='topic_input', help='Enter a topic of interest')
89
+
90
+ if st.sidebar.button('Get Suggestions'):
91
+
92
+ with st.status(
93
+ "🤖 **Agents at work...**", state="running", expanded=True
94
+ ) as status:
95
+ with st.container(height=500, border=False):
96
+ log_container = st.empty()
97
+ suggester = RecentArticleSuggester()
98
+ inputs = {"topic": topic}
99
+ results = suggester.kickoff(inputs=inputs)
100
+ status.update(
101
+ label="✅ Articles are Ready for Reading!",
102
+ state="complete",
103
+ expanded=False,
104
+ )
105
+
106
+ st.subheader("", anchor=False, divider="rainbow")
107
+
108
+
109
+
110
+ if results is None:
111
+ st.markdown('No articles found.', unsafe_allow_html=True)
112
+ else:
113
+
114
+ st.markdown('<p class="subheader">Results:</p>', unsafe_allow_html=True)
115
+
116
+ for element in results:
117
+ st.markdown(
118
+ f"""
119
+ <div class="element">
120
+ <h3><a href="{element['url']}" target="_blank">{element['title']}</a></h3>
121
+ <ul>
122
+ {"".join(f"<li style='font-size: 20px;'><b>{key.capitalize()}:</b> {value}</li>" for key, value in element.items() if key != "title")}
123
+ </ul>
124
+ </div>
125
+ """,
126
+ unsafe_allow_html=True
127
+ )
128
+
129
+ if __name__ == "__main__":
130
+ main()