shravya commited on
Commit
41c2364
Β·
1 Parent(s): 7b4a850

removed extra cards

Browse files
beautiful_code_logo.jpeg DELETED
Binary file (11.8 kB)
 
pages.py DELETED
@@ -1,35 +0,0 @@
1
- # sidebar.py
2
-
3
- import streamlit as st
4
- import streamlit_router as sr
5
-
6
- def common_sidebar(router):
7
- st.sidebar.markdown("# Sidebar Navigation")
8
- st.sidebar.markdown("---")
9
- st.sidebar.markdown("### Pages")
10
- if st.sidebar.button("Home"):
11
- router.redirect(*router.build('/'))
12
- if st.sidebar.button("TIL Feedback"):
13
- router.redirect(*router.build('/feedback'))
14
- if st.sidebar.button("Course Suggester"):
15
- router.redirect(*router.build('/course_suggester'))
16
- if st.sidebar.button("Course Lesson Extractor"):
17
- router.redirect(*router.build('/lessons_extractor'))
18
- if st.sidebar.button("Article Recommender"):
19
- router.redirect(*router.build('/article_recommendor'))
20
- if st.sidebar.button("Recent Article Suggester"):
21
- router.redirect(*router.build('/research_article_suggester'))
22
-
23
- def with_sidebar(func):
24
- def wrapper(*args, **kwargs):
25
- from ui_main import router # Import router from the main file
26
- current_route = st.query_params.get("route", [""])[0]
27
-
28
- if current_route in ['feedback', 'course_suggester', 'lessons_extractor', 'article_recommendor', 'research_article_suggester']:
29
- common_sidebar(router)
30
-
31
- return func(*args, **kwargs)
32
- return wrapper
33
-
34
-
35
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ui/article_recommendation.py DELETED
@@ -1,108 +0,0 @@
1
- from dotenv import load_dotenv
2
- import json
3
- import streamlit as st
4
- import utils.settings as settings
5
- from workflows.article_suggestion import article_recommendation_crew
6
- from utils.write_to_json import write_dict_to_json as write_dict_to_json
7
- load_dotenv()
8
- settings.init()
9
-
10
-
11
- def icon(emoji: str):
12
- """Shows an emoji as a Notion-style page icon."""
13
- st.write(
14
- f'<span style="font-size: 78px; line-height: 1">{emoji}</span>',
15
- unsafe_allow_html=True,
16
- )
17
-
18
-
19
- def article_recommendor_main():
20
- page_bg_img = '''
21
- <style>
22
- [data-testid="stAppViewContainer"]{
23
- background-image:url("https://www.shutterstock.com/image-vector/abstract-technology-communication-concept-vector-600nw-1914443275.jpg");
24
- background-size:cover;
25
- }
26
- [data-testid="stHeader"]{
27
- background: rgba(0,0,0,0);
28
- }
29
- [data-testid="stToolbar"]{
30
- right: 2rem;
31
- }
32
-
33
-
34
- </style>
35
- '''
36
- st.markdown(page_bg_img, unsafe_allow_html=True)
37
- icon("πŸ“– Articles RecommendAIgent")
38
- st.subheader("Let AI agents recommend articles based on your interest!")
39
-
40
- with st.sidebar:
41
- st.header("πŸ‘‡ Provide Your Interests Below!")
42
- with st.form("user_input_form", border=True):
43
- interests = st.text_input(
44
- "Enter your interests (comma-separated):",
45
- "GenAI, Architecture, Agentic Programming",
46
- )
47
- previous_article_insights = st.text_area(
48
- "Enter previous article insights:",
49
- "Agentic Design Patterns (https://www.deeplearning.ai/the-batch/how-agents-can-improve-llm-performance/)\n"
50
- "Reflection: The LLM examines its own work to come up with ways to improve it. "
51
- "Tool Use: The LLM is given tools such as web search, code execution, or any other function to help it gather information, take action, or process data. "
52
- "Planning: The LLM comes up with, and executes, a multistep plan to achieve a goal "
53
- "Multi-agent collaboration: More than one AI agent work together, splitting up tasks and discussing and debating ideas, to come up with better solutions than a single agent would.\n\n"
54
- "GenAI Multi-Agent Systems (https://thenewstack.io/genai-multi-agent-systems-a-secret-weapon-for-tech-teams/)\n"
55
- "Multi-agent systems go beyond the task-oriented roles to truly super-charge development and strategy teams. "
56
- "Successful multi-agent systems act as a β€œdigital twin” for your development team. "
57
- "Different Approaches: 1. Centralized, with one agent in the center that collects and assimilates all the other outputs. "
58
- "2. Distributed, where there is no central controller and the agents coordinate directly with one another in an β€œagent swarm. "
59
- "3. Hierarchical, where agents are organized in teams or hierarchical layers.\n\n"
60
- "LLM Model Quantisation\n"
61
- "Different Methods for Compression: Pruning, Knowledge Distiallation and Quantization."
62
- "Quantization process represents the model weights in lower precession which is also known as downcasting."
63
- "Quanitzatoin Error is the difference in the weights of the quantized model and the original model."
64
- "Advantages of Quanitzation: Reduced memory footprint, increased compute and speed of inferrence."
65
- "Disadvantages of Quantization: Less precise.\n\n",
66
- height=400,
67
- )
68
- st.markdown("")
69
- submitted = st.form_submit_button("Submit")
70
-
71
- if submitted:
72
- with st.status(
73
- "πŸ€– **Agents at work...**", state="running", expanded=True
74
- ) as status:
75
- with st.container(height=500, border=False):
76
- result = article_recommendation_crew.kickoff(
77
- inputs={
78
- "interests": interests,
79
- "previous_article_insights": previous_article_insights,
80
- }
81
- )
82
- status.update(
83
- label="βœ… Articles are Ready for Reading!",
84
- state="complete",
85
- expanded=False,
86
- )
87
-
88
- st.subheader("", anchor=False, divider="rainbow")
89
-
90
- articles_list = settings.articles.values()
91
-
92
- if articles_list is None:
93
- st.markdown("No articles found.")
94
- return
95
- else:
96
- for article in articles_list:
97
- st.markdown(f"# {article['title']}")
98
- st.markdown(f"**URL:** [{article['url']}]({article['url']})")
99
- st.markdown(f"**Pitch:** {article.get('pitch', '')}")
100
- st.markdown(f"**Evaluation Score:** {article.get('evaluation_score', '')}")
101
- st.markdown(f"**Evaluation Reason:** {article.get('evaluation_reason', '')}")
102
- st.markdown(f"**Reason For Recommendation:** {article.get('reason_for_recommendation', '')}")
103
- st.markdown("---")
104
-
105
- if st.sidebar.button("← Back to Main Page"):
106
- st.session_state.page = "main"
107
- if __name__ == "__main__":
108
- article_recommendor_main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ui/course_lessons_extractor.py DELETED
@@ -1,74 +0,0 @@
1
- import streamlit as st
2
- import asyncio
3
- from contextlib import contextmanager
4
- from dotenv import load_dotenv
5
- from workflows.courses.lessons_extractor import LessonsExtractor
6
- from streamlit_extras.capture import stdout
7
-
8
- load_dotenv()
9
-
10
-
11
- @contextmanager
12
- def setup_event_loop():
13
- loop = asyncio.new_event_loop()
14
- asyncio.set_event_loop(loop)
15
- try:
16
- yield loop
17
- finally:
18
- loop.close()
19
- asyncio.set_event_loop(None)
20
- def lessons_extractor_main():
21
- page_bg_img = '''
22
- <style>
23
- [data-testid="stAppViewContainer"]{
24
- background-image:url("https://www.shutterstock.com/image-vector/abstract-technology-communication-concept-vector-600nw-1914443275.jpg");
25
- background-size:cover;
26
- }
27
- [data-testid="stHeader"]{
28
- background: rgba(0,0,0,0);
29
- }
30
- [data-testid="stToolbar"]{
31
- right: 2rem;
32
- }
33
-
34
-
35
- </style>
36
- '''
37
- st.markdown(page_bg_img, unsafe_allow_html=True)
38
- st.markdown("<div class='container'>", unsafe_allow_html=True)
39
-
40
- st.markdown(
41
- """
42
- <div class="centered">
43
- <p class="title">Course Lesson Extractor</p>
44
- </div>
45
- """,
46
- unsafe_allow_html=True
47
- )
48
- course_url = st.text_area('Enter the URL for the course:',
49
- "https://www.coursera.org/learn/google-data-analytics-capstone?specialization=google-data-analytics",
50
- key='course_url', help='Enter course you want to learn')
51
-
52
- if st.button("Get Lessons"):
53
- with st.status(
54
- "πŸ€– **Extracting Lessons...**", state="running", expanded=True
55
- ) as status:
56
- with st.container(height=500, border=False):
57
- log_container = st.empty()
58
- with stdout(log_container.code, terminator=""):
59
- with setup_event_loop() as loop:
60
- extractor = LessonsExtractor()
61
- inputs = {"course_url": course_url}
62
- results = extractor.kickoff(inputs=inputs)["lessons"]
63
- status.update(
64
- label="βœ… Extracted Lessons!",
65
- state="complete",
66
- expanded=False,
67
- )
68
-
69
- for idx, lesson in enumerate(results):
70
- st.markdown(f"#### Lessons {idx}: {lesson['name']}")
71
- st.markdown(f"Concpets: {', '.join(lesson['concepts'])}")
72
-
73
- if __name__ == "__main__":
74
- lessons_extractor_main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ui/research_paper.py DELETED
@@ -1,144 +0,0 @@
1
- import streamlit as st
2
- from workflows.research_article_suggester import RecentArticleSuggester
3
- from streamlit_extras.capture import stdout
4
-
5
-
6
-
7
-
8
-
9
- def research_article_suggester_main():
10
-
11
- st.markdown(
12
- """
13
- <style>
14
- # .main {
15
- # background-color: #f5f5f5;
16
- # padding: 20px;
17
- # border-radius: 10px;
18
- # }
19
- .centered {
20
- display: flex;
21
- flex-direction: column;
22
- align-items: center;
23
- justify-content: center;
24
- text-align: center;
25
- }
26
- .title {
27
- font-family: 'Helvetica', sans-serif;
28
- font-weight: bold;
29
- font-size: 36px;
30
- color: #1f77b4;
31
- }
32
- .description {
33
- font-family: 'Helvetica', sans-serif;
34
- font-size: 18px;
35
- color: #333333;
36
- margin-top: 10px;
37
- }
38
- .subheader {
39
- font-family: 'Helvetica', sans-serif;
40
- font-weight: bold;
41
- font-size: 24px;
42
- color: #ff7f0e;
43
- margin-top: 20px;
44
- }
45
- .element {
46
- background-color: #ffffff;
47
- padding: 1rem;
48
- border-radius: 8px;
49
- box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
50
- margin-bottom: 1rem;
51
- }
52
- .element h3 {
53
- font-size: 24px;
54
- color: #1f77b4;
55
- margin-bottom: 0.5rem;
56
- text-transform: uppercase;
57
- padding :10px;
58
-
59
- }
60
- .element ul {
61
- list-style-type: none;
62
- padding: 0;
63
- margin: 0;
64
- }
65
- .element li {
66
- font-size: 16px;
67
- color: #333333;
68
- margin-bottom: 0.5rem;
69
- }
70
- .element li b {
71
- font-size: 22px;
72
- }
73
- [data-testid="stAppViewContainer"]{
74
- background-image:url("https://www.shutterstock.com/image-vector/abstract-technology-communication-concept-vector-600nw-1914443275.jpg");
75
- background-size:cover;
76
- }
77
- [data-testid="stHeader"]{
78
- background: rgba(0,0,0,0);
79
- }
80
- [data-testid="stToolbar"]{
81
- right: 2rem;
82
- }
83
-
84
- </style>
85
- """,
86
- unsafe_allow_html=True
87
- )
88
-
89
- st.markdown("<div class='container'>", unsafe_allow_html=True)
90
-
91
- st.markdown(
92
- """
93
- <div class="centered">
94
- <p class="title">Recent Article Suggester</p>
95
- <p class="description">Discover recent articles based on your topic of interest using advanced AI.</p>
96
- </div>
97
- """,
98
- unsafe_allow_html=True
99
- )
100
-
101
- st.sidebar.markdown("<p class='sidebar-header'>Search for the papers you are interested in:</p>", unsafe_allow_html=True)
102
- topic = st.sidebar.text_input('Enter a topic:', 'GenAI', key='topic_input', help='Enter a topic of interest')
103
-
104
- if st.sidebar.button('Get Suggestions'):
105
-
106
- with st.status(
107
- "πŸ€– **Agents at work...**", state="running", expanded=True
108
- ) as status:
109
- with st.container(height=500, border=False):
110
- log_container = st.empty()
111
- with stdout(log_container.code, terminator=""):
112
- suggester = RecentArticleSuggester()
113
- inputs = {"topic": topic}
114
- results = suggester.kickoff(inputs=inputs)
115
- status.update(
116
- label="βœ… Articles are Ready for Reading!",
117
- state="complete",
118
- expanded=False,
119
- )
120
-
121
- st.subheader("", anchor=False, divider="rainbow")
122
-
123
- if results is None:
124
- st.markdown('No articles found.', unsafe_allow_html=True)
125
- else:
126
-
127
- st.markdown('<p class="subheader">Results:</p>', unsafe_allow_html=True)
128
-
129
- for element in results:
130
- st.markdown(
131
- f"""
132
- <div class="element">
133
- <h3><a href="{element['url']}" target="_blank">{element['title']}</a></h3>
134
- <ul>
135
- {"".join(f"<li style='font-size: 20px;'><b>{key.capitalize()}:</b> {value}</li>" for key, value in element.items() if key != "title")}
136
- </ul>
137
- </div>
138
- """,
139
- unsafe_allow_html=True
140
- )
141
- if st.sidebar.button("← Back to Main Page"):
142
- st.session_state.page = "main"
143
- if __name__ == "__main__":
144
- research_aricle_suggester_main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ui/til_feedback.py CHANGED
@@ -5,11 +5,8 @@ from streamlit_extras.capture import stdout
5
  from langsmith import Client
6
  from workflows.utils.feedback import Feedback
7
 
8
-
9
-
10
  load_dotenv()
11
 
12
-
13
  def feedback_main():
14
 
15
  page_bg_img = '''
 
5
  from langsmith import Client
6
  from workflows.utils.feedback import Feedback
7
 
 
 
8
  load_dotenv()
9
 
 
10
  def feedback_main():
11
 
12
  page_bg_img = '''
ui_main.py CHANGED
@@ -1,11 +1,7 @@
1
  from dotenv import load_dotenv
2
  from streamlit_extras.stylable_container import stylable_container
3
- from ui.article_recommendation import article_recommendor_main
4
- from ui.course_lessons_extractor import lessons_extractor_main
5
- from ui.research_paper import research_article_suggester_main
6
  from ui.til_feedback import feedback_main
7
  from ui.course_learn_suggest_expectations import course_suggester_main
8
- # from pages import card_main
9
  import math
10
  import streamlit as st
11
  import subprocess
@@ -28,9 +24,7 @@ def common_sidebar():
28
  st.sidebar.button("Home", on_click=lambda: router.redirect(*router.build("show_main_page")))
29
  st.sidebar.button("TIL Feedback", on_click=lambda: router.redirect(*router.build("feedback_main_wrapper")))
30
  st.sidebar.button("Course Suggester", on_click=lambda: router.redirect(*router.build("course_suggester_main_wrapper")))
31
- st.sidebar.button("Course Lesson Extractor", on_click=lambda: router.redirect(*router.build("lessons_extractor_main_wrapper")))
32
- st.sidebar.button("Article Recommender", on_click=lambda: router.redirect(*router.build("article_recommendor_main_wrapper")))
33
- st.sidebar.button("Recent Article Suggester", on_click=lambda: router.redirect(*router.build("research_article_suggester_main_wrapper")))
34
 
35
 
36
  def show_main_page():
@@ -61,20 +55,10 @@ def show_main_page():
61
  st.markdown('<div class="main-title">Welcome to Growthy AI Workflows!</div>', unsafe_allow_html=True)
62
  st.markdown("---")
63
 
64
- # card_info = [
65
- # {"title": "TIL Feedback", "description": "Provide your valuable feedback.", "key": "feedback_main_wrapper","image":"https://agent.ai/icons/search.svg"},
66
- # {"title": "Course Suggester", "description": "Get suggestions for courses", "key": "course_suggester_main_wrapper","image":"https://agent.ai/icons/prospecting.svg"},
67
- # {"title": "Course Lesson Extractor", "description": "Extract lessons for a given course", "key": "lessons_extractor_main_wrapper","image":"https://agent.ai/icons/business-analyst.svg"},
68
- # {"title": "Article Recommender", "description": "Discover articles tailored to your interests.", "key": "article_recommendor_main_wrapper","image":"https://agent.ai/icons/robot.svg"},
69
- # {"title": "Recent Article Suggester", "description": "Get suggestions for recent research articles.", "key": "research_article_suggester_main_wrapper","image":"https://agent.ai/icons/data.svg"},
70
-
71
- # ]
72
  card_info = [
73
  {"title": "TIL Feedback", "description": "Provide your valuable feedback.", "key": "feedback_main_wrapper", "image": "πŸ“"},
74
  {"title": "Course Suggester", "description": "Get suggestions for courses", "key": "course_suggester_main_wrapper", "image": "πŸ“š"},
75
- {"title": "Course Lesson Extractor", "description": "Extract lessons for a given course", "key": "lessons_extractor_main_wrapper", "image": "πŸ“‘"},
76
- {"title": "Article Recommender", "description": "Discover articles tailored to your interests.", "key": "article_recommendor_main_wrapper", "image": "πŸ“°"},
77
- {"title": "Recent Article Suggester", "description": "Get suggestions for recent research articles.", "key": "research_article_suggester_main_wrapper", "image": "πŸ”"},
78
  ]
79
 
80
  num_cols = 3
@@ -110,7 +94,6 @@ def show_main_page():
110
  margin-bottom: 10px;
111
  } """,
112
  ):
113
- # with st.container():
114
  st.markdown(
115
  f"""
116
  <div style="
@@ -131,8 +114,6 @@ def show_main_page():
131
  )
132
  if st.button("Explore", key=card["key"]):
133
  router.redirect(*router.build(f"{card['key']}"))
134
- # st.experimental_rerun()
135
- # st.session_state.page = card["key"]
136
 
137
  st.markdown(
138
  """
@@ -153,7 +134,7 @@ def show_main_page():
153
  """, unsafe_allow_html=True
154
  )
155
 
156
- # Wrapping each main page function to include the common sidebar
157
  def feedback_main_wrapper():
158
  common_sidebar()
159
  feedback_main()
@@ -162,25 +143,13 @@ def course_suggester_main_wrapper():
162
  common_sidebar()
163
  course_suggester_main()
164
 
165
- def lessons_extractor_main_wrapper():
166
- common_sidebar()
167
- lessons_extractor_main()
168
-
169
- def article_recommendor_main_wrapper():
170
- common_sidebar()
171
- article_recommendor_main()
172
 
173
- def research_article_suggester_main_wrapper():
174
- common_sidebar()
175
- research_article_suggester_main()
176
 
177
  router = sr.StreamlitRouter()
178
 
179
  router.register(show_main_page, '/')
180
  router.register(feedback_main_wrapper, '/feedback', methods=['GET'])
181
  router.register(course_suggester_main_wrapper, '/course_suggester')
182
- router.register(lessons_extractor_main_wrapper, '/lessons_extractor')
183
- router.register(article_recommendor_main_wrapper, '/article_recommendor')
184
- router.register(research_article_suggester_main_wrapper, '/research_article_suggester')
185
 
186
  router.serve()
 
1
  from dotenv import load_dotenv
2
  from streamlit_extras.stylable_container import stylable_container
 
 
 
3
  from ui.til_feedback import feedback_main
4
  from ui.course_learn_suggest_expectations import course_suggester_main
 
5
  import math
6
  import streamlit as st
7
  import subprocess
 
24
  st.sidebar.button("Home", on_click=lambda: router.redirect(*router.build("show_main_page")))
25
  st.sidebar.button("TIL Feedback", on_click=lambda: router.redirect(*router.build("feedback_main_wrapper")))
26
  st.sidebar.button("Course Suggester", on_click=lambda: router.redirect(*router.build("course_suggester_main_wrapper")))
27
+
 
 
28
 
29
 
30
  def show_main_page():
 
55
  st.markdown('<div class="main-title">Welcome to Growthy AI Workflows!</div>', unsafe_allow_html=True)
56
  st.markdown("---")
57
 
 
 
 
 
 
 
 
 
58
  card_info = [
59
  {"title": "TIL Feedback", "description": "Provide your valuable feedback.", "key": "feedback_main_wrapper", "image": "πŸ“"},
60
  {"title": "Course Suggester", "description": "Get suggestions for courses", "key": "course_suggester_main_wrapper", "image": "πŸ“š"},
61
+
 
 
62
  ]
63
 
64
  num_cols = 3
 
94
  margin-bottom: 10px;
95
  } """,
96
  ):
 
97
  st.markdown(
98
  f"""
99
  <div style="
 
114
  )
115
  if st.button("Explore", key=card["key"]):
116
  router.redirect(*router.build(f"{card['key']}"))
 
 
117
 
118
  st.markdown(
119
  """
 
134
  """, unsafe_allow_html=True
135
  )
136
 
137
+
138
  def feedback_main_wrapper():
139
  common_sidebar()
140
  feedback_main()
 
143
  common_sidebar()
144
  course_suggester_main()
145
 
 
 
 
 
 
 
 
146
 
 
 
 
147
 
148
  router = sr.StreamlitRouter()
149
 
150
  router.register(show_main_page, '/')
151
  router.register(feedback_main_wrapper, '/feedback', methods=['GET'])
152
  router.register(course_suggester_main_wrapper, '/course_suggester')
153
+
 
 
154
 
155
  router.serve()