Sharan1712 commited on
Commit
5aed948
·
verified ·
1 Parent(s): 286a2e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +190 -190
app.py CHANGED
@@ -1,190 +1,190 @@
1
- import streamlit as st
2
- import os
3
- import yaml
4
- from crewai import LLM
5
- from agents import *
6
-
7
- # Streamlit Page Config
8
- st.set_page_config(
9
- page_title = "Project Planner",
10
- page_icon = "🛠️",
11
- layout = "wide",
12
- initial_sidebar_state = "expanded")
13
-
14
- # Logo
15
- st.logo(
16
- "https://cdn.prod.website-files.com/66cf2bfc3ed15b02da0ca770/66d07240057721394308addd_Logo%20(1).svg",
17
- link = "https://www.crewai.com/",
18
- size = "large"
19
- )
20
-
21
- col1, col2, col3 = st.columns([1, 9, 1])
22
- with col2:
23
- # Title and description
24
- st.title("AI Project Planner, powered by :red[CrewAI]")
25
- st.markdown("Create an detailed project plan with resource allocation and a timeline for tasks and milestones using AI agents.")
26
-
27
- # Sidebar
28
- with st.sidebar:
29
- st.markdown("### ⚙️ Model API Configuration")
30
- st.write("")
31
-
32
- model_options = [
33
- "gpt-4o-mini",
34
- "gpt-4o",
35
- "o1",
36
- "o1-mini",
37
- "o1-preview"
38
- "o3-mini"
39
- ]
40
-
41
- selected_model = st.selectbox("🤖 Select which LLM to use", model_options, key = "selected_model")
42
-
43
- with st.expander("🔑 API Keys", expanded = True):
44
-
45
- st.info("API keys are stored temporarily in memory and cleared when you close the browser.")
46
-
47
- openai_api_key = st.text_input(
48
- "OpenAI API Key",
49
- type = "password",
50
- placeholder = "Enter your OpenAI API key",
51
- help = "Enter your OpenAI API key"
52
- )
53
-
54
- if openai_api_key:
55
- os.environ["OPENAI_API_KEY"] = openai_api_key
56
-
57
- # serper_api_key = st.text_input(
58
- # "Serper API Key",
59
- # type = "password",
60
- # placeholder = "Enter your Serper API key",
61
- # help = "Enter your Serper API key for web search capabilities"
62
- # )
63
- # if serper_api_key:
64
- # os.environ["SERPER_API_KEY"] = serper_api_key
65
-
66
- st.write("")
67
-
68
- with st.expander("ℹ️ About", expanded=False):
69
- st.markdown(
70
- """This Project Planner uses advanced AI Agents to help you:
71
- - Strategically think and breakdown projects into actionable tasks and setting precise timelines.
72
- - Provide highly accurate time, resource, and effort estimations for each task.
73
- - Optimize the allocation of tasks for the project by balancing team members' skills, availability, and current workload.
74
-
75
- Choose your preferred model and enter the required API keys to get started.""")
76
-
77
- if not os.environ.get("OPENAI_API_KEY"):
78
- st.warning("⚠️ Please enter your OpenAI API key in the sidebar to get started")
79
- st.stop()
80
-
81
- # if not os.environ.get("SERPER_API_KEY"):
82
- # st.warning("⚠️ Please enter your Serper API key in the sidebar to get started")
83
- # st.stop()
84
-
85
- # Define file paths for YAML configurations
86
- files = {
87
- 'agents': 'config/agents.yaml',
88
- 'tasks': 'config/tasks.yaml'
89
- }
90
-
91
- # Load configurations from YAML files
92
- configs = {}
93
- for config_type, file_path in files.items():
94
- with open(file_path, 'r') as file:
95
- configs[config_type] = yaml.safe_load(file)
96
-
97
- # Assign loaded configurations to specific variables
98
- agents_config = configs['agents']
99
- tasks_config = configs['tasks']
100
-
101
- llm = llm = LLM(model = f"openai/{selected_model}")
102
- planner_crew = ProjectPlanner(agents_config, tasks_config, llm)
103
-
104
- # Create two columns for the input section
105
- input_col1, input_col2, input_col3 = st.columns([3, 3, 5])
106
-
107
- with input_col1:
108
- project_topic = st.text_area(
109
- "Project Topic",
110
- height = 80,
111
- placeholder = "Enter the project topic (eg Website, Hiring, Building)"
112
- )
113
-
114
- with input_col2:
115
- industry = st.text_area(
116
- "Industry",
117
- height = 80,
118
- placeholder = "Enter the industry (eg Technology, Finance, Construction)"
119
- )
120
-
121
- with input_col3:
122
- objective = st.text_area(
123
- "Project Objective",
124
- height = 80,
125
- placeholder = "Enter the project objective (eg Build a website for a small business)"
126
- )
127
-
128
- input_col4, input_col5 = st.columns([3,2])
129
-
130
- with input_col4:
131
- project_requirements = st.text_area(
132
- "Project Requirements (Brief bullet points)",
133
- height = 190,
134
- placeholder = """Enter bullet points of project requirements.
135
- eg:
136
- - Create a responsive design that works well on desktop and mobile devices
137
- - Implement a modern, visually appealing user interface with a clean look
138
- - Develop a user-friendly navigation system with intuitive menu structure
139
- - Include an "About Us" page highlighting the company's history and values
140
- - Design a "Services" page showcasing the business's offerings with descriptions"""
141
- )
142
-
143
- with input_col5:
144
- team_members = st.text_area(
145
- "Team Members",
146
- height = 190,
147
- placeholder = """Enter the Team Member names are their roles.
148
- eg:
149
- - John Doe (Project Manager)
150
- - Jane Doe (Software Engineer)
151
- - Bob Smith (Designer)
152
- - Alice Johnson (QA Engineer)
153
- - Tom Brown (QA Engineer)
154
- """
155
- )
156
-
157
- generate_button = st.button("🚀 Plan My Project", use_container_width = False, type = "primary")
158
-
159
- if generate_button:
160
- with st.spinner("Generating content... This may take a moment."):
161
- try:
162
- project_details = {
163
- 'project_type': project_topic,
164
- 'project_objectives': objective,
165
- 'industry': industry,
166
- 'team_members': team_members,
167
- 'project_requirements': project_requirements
168
- }
169
- df_tasks, df_milestones = planner_crew.getPlanning(project_details)
170
-
171
- except Exception as e:
172
- st.error(f"An error occurred: {str(e)}")
173
-
174
- st.markdown("## Task Breakdown:")
175
- st.dataframe(df_tasks)
176
-
177
- st.divider()
178
-
179
- st.markdown("## Milestone Details")
180
- st.dataframe(df_milestones)
181
-
182
-
183
-
184
-
185
- # Add footer
186
- st.divider()
187
- footer_col1, footer_col2, footer_col3 = st.columns([1, 2, 1])
188
- with footer_col2:
189
- st.caption("Made with ❤️ using [CrewAI](https://crewai.com) and [Streamlit](https://streamlit.io)")
190
- st.caption("By [Sharan Shyamsundar](http://sharan1712.github.io/)")
 
1
+ import streamlit as st
2
+ import os
3
+ import yaml
4
+ from crewai import LLM
5
+ from agents import *
6
+
7
+ # Streamlit Page Config
8
+ st.set_page_config(
9
+ page_title = "Project Planner",
10
+ page_icon = "🛠️",
11
+ layout = "wide",
12
+ initial_sidebar_state = "expanded")
13
+
14
+ # Logo
15
+ st.logo(
16
+ "https://cdn.prod.website-files.com/66cf2bfc3ed15b02da0ca770/66d07240057721394308addd_Logo%20(1).svg",
17
+ link = "https://www.crewai.com/",
18
+ size = "large"
19
+ )
20
+
21
+ col1, col2, col3 = st.columns([1, 9, 1])
22
+ with col2:
23
+ # Title and description
24
+ st.title("AI Project Planner, powered by :red[CrewAI]")
25
+ st.markdown("Create an detailed project plan with resource allocation and a timeline for tasks and milestones using AI agents.")
26
+
27
+ # Sidebar
28
+ with st.sidebar:
29
+ st.markdown("### ⚙️ Model API Configuration")
30
+ st.write("")
31
+
32
+ model_options = [
33
+ "gpt-4o-mini",
34
+ "gpt-4o",
35
+ "o1",
36
+ "o1-mini",
37
+ "o1-preview",
38
+ "o3-mini"
39
+ ]
40
+
41
+ selected_model = st.selectbox("🤖 Select which LLM to use", model_options, key = "selected_model")
42
+
43
+ with st.expander("🔑 API Keys", expanded = True):
44
+
45
+ st.info("API keys are stored temporarily in memory and cleared when you close the browser.")
46
+
47
+ openai_api_key = st.text_input(
48
+ "OpenAI API Key",
49
+ type = "password",
50
+ placeholder = "Enter your OpenAI API key",
51
+ help = "Enter your OpenAI API key"
52
+ )
53
+
54
+ if openai_api_key:
55
+ os.environ["OPENAI_API_KEY"] = openai_api_key
56
+
57
+ # serper_api_key = st.text_input(
58
+ # "Serper API Key",
59
+ # type = "password",
60
+ # placeholder = "Enter your Serper API key",
61
+ # help = "Enter your Serper API key for web search capabilities"
62
+ # )
63
+ # if serper_api_key:
64
+ # os.environ["SERPER_API_KEY"] = serper_api_key
65
+
66
+ st.write("")
67
+
68
+ with st.expander("ℹ️ About", expanded=False):
69
+ st.markdown(
70
+ """This Project Planner uses advanced AI Agents to help you:
71
+ - Strategically think and breakdown projects into actionable tasks and setting precise timelines.
72
+ - Provide highly accurate time, resource, and effort estimations for each task.
73
+ - Optimize the allocation of tasks for the project by balancing team members' skills, availability, and current workload.
74
+
75
+ Choose your preferred model and enter the required API keys to get started.""")
76
+
77
+ if not os.environ.get("OPENAI_API_KEY"):
78
+ st.warning("⚠️ Please enter your OpenAI API key in the sidebar to get started")
79
+ st.stop()
80
+
81
+ # if not os.environ.get("SERPER_API_KEY"):
82
+ # st.warning("⚠️ Please enter your Serper API key in the sidebar to get started")
83
+ # st.stop()
84
+
85
+ # Define file paths for YAML configurations
86
+ files = {
87
+ 'agents': 'config/agents.yaml',
88
+ 'tasks': 'config/tasks.yaml'
89
+ }
90
+
91
+ # Load configurations from YAML files
92
+ configs = {}
93
+ for config_type, file_path in files.items():
94
+ with open(file_path, 'r') as file:
95
+ configs[config_type] = yaml.safe_load(file)
96
+
97
+ # Assign loaded configurations to specific variables
98
+ agents_config = configs['agents']
99
+ tasks_config = configs['tasks']
100
+
101
+ llm = llm = LLM(model = f"openai/{selected_model}")
102
+ planner_crew = ProjectPlanner(agents_config, tasks_config, llm)
103
+
104
+ # Create two columns for the input section
105
+ input_col1, input_col2, input_col3 = st.columns([3, 3, 5])
106
+
107
+ with input_col1:
108
+ project_topic = st.text_area(
109
+ "Project Topic",
110
+ height = 80,
111
+ placeholder = "Enter the project topic (eg Website, Hiring, Building)"
112
+ )
113
+
114
+ with input_col2:
115
+ industry = st.text_area(
116
+ "Industry",
117
+ height = 80,
118
+ placeholder = "Enter the industry (eg Technology, Finance, Construction)"
119
+ )
120
+
121
+ with input_col3:
122
+ objective = st.text_area(
123
+ "Project Objective",
124
+ height = 80,
125
+ placeholder = "Enter the project objective (eg Build a website for a small business)"
126
+ )
127
+
128
+ input_col4, input_col5 = st.columns([3,2])
129
+
130
+ with input_col4:
131
+ project_requirements = st.text_area(
132
+ "Project Requirements (Brief bullet points)",
133
+ height = 190,
134
+ placeholder = """Enter bullet points of project requirements.
135
+ eg:
136
+ - Create a responsive design that works well on desktop and mobile devices
137
+ - Implement a modern, visually appealing user interface with a clean look
138
+ - Develop a user-friendly navigation system with intuitive menu structure
139
+ - Include an "About Us" page highlighting the company's history and values
140
+ - Design a "Services" page showcasing the business's offerings with descriptions"""
141
+ )
142
+
143
+ with input_col5:
144
+ team_members = st.text_area(
145
+ "Team Members",
146
+ height = 190,
147
+ placeholder = """Enter the Team Member names are their roles.
148
+ eg:
149
+ - John Doe (Project Manager)
150
+ - Jane Doe (Software Engineer)
151
+ - Bob Smith (Designer)
152
+ - Alice Johnson (QA Engineer)
153
+ - Tom Brown (QA Engineer)
154
+ """
155
+ )
156
+
157
+ generate_button = st.button("🚀 Plan My Project", use_container_width = False, type = "primary")
158
+
159
+ if generate_button:
160
+ with st.spinner("Generating content... This may take a moment."):
161
+ try:
162
+ project_details = {
163
+ 'project_type': project_topic,
164
+ 'project_objectives': objective,
165
+ 'industry': industry,
166
+ 'team_members': team_members,
167
+ 'project_requirements': project_requirements
168
+ }
169
+ df_tasks, df_milestones = planner_crew.getPlanning(project_details)
170
+
171
+ except Exception as e:
172
+ st.error(f"An error occurred: {str(e)}")
173
+
174
+ st.markdown("## Task Breakdown:")
175
+ st.dataframe(df_tasks)
176
+
177
+ st.divider()
178
+
179
+ st.markdown("## Milestone Details")
180
+ st.dataframe(df_milestones)
181
+
182
+
183
+
184
+
185
+ # Add footer
186
+ st.divider()
187
+ footer_col1, footer_col2, footer_col3 = st.columns([1, 2, 1])
188
+ with footer_col2:
189
+ st.caption("Made with ❤️ using [CrewAI](https://crewai.com) and [Streamlit](https://streamlit.io)")
190
+ st.caption("By [Sharan Shyamsundar](http://sharan1712.github.io/)")