Prathamesh1420 commited on
Commit
803595b
1 Parent(s): 64b6e2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -15
app.py CHANGED
@@ -5,12 +5,13 @@ import warnings
5
  from crewai import Agent, Task, Crew
6
  from langchain_google_genai import ChatGoogleGenerativeAI
7
  from crewai_tools import FileReadTool, ScrapeWebsiteTool, SerperDevTool
 
8
 
9
  # Warning control
10
  warnings.filterwarnings('ignore')
11
 
12
  # Set the Google API key directly in the code
13
- google_api_key = "AIzaSyDy02GtpV6-VcdeCZNLJT-c4kWuPxBRbrI"
14
 
15
  # Function to initialize the Gemini model with an event loop
16
  async def initialize_llm():
@@ -124,6 +125,7 @@ resume_strategy_task = Task(
124
  expected_output=(
125
  "An updated resume that effectively highlights the candidate's qualifications and experiences relevant to the job."
126
  ),
 
127
  context=[research_task, profile_task],
128
  agent=resume_strategist
129
  )
@@ -137,6 +139,7 @@ interview_preparation_task = Task(
137
  expected_output=(
138
  "A document containing key questions and talking points that the candidate should prepare for the initial interview."
139
  ),
 
140
  context=[research_task, profile_task, resume_strategy_task],
141
  agent=interview_preparer
142
  )
@@ -157,17 +160,22 @@ job_application_inputs = {
157
  }
158
 
159
  # Running Tasks
160
- results = job_application_crew.kickoff(inputs=job_application_inputs)
161
-
162
- # Display Results
163
- st.write("**Job Requirements:**")
164
- st.write(results['job_requirements'])
165
-
166
- st.write("**Personal Profile:**")
167
- st.write(results['personal_profile'])
168
-
169
- st.write("**Tailored Resume:**")
170
- st.write(results['tailored_resume'])
171
-
172
- st.write("**Interview Materials:**")
173
- st.write(results['interview_materials'])
 
 
 
 
 
 
5
  from crewai import Agent, Task, Crew
6
  from langchain_google_genai import ChatGoogleGenerativeAI
7
  from crewai_tools import FileReadTool, ScrapeWebsiteTool, SerperDevTool
8
+ import json
9
 
10
  # Warning control
11
  warnings.filterwarnings('ignore')
12
 
13
  # Set the Google API key directly in the code
14
+ google_api_key = "AIzaSyCHHl4LgpZIBw3_Zf15XWuuLSWWIlLROdQ"
15
 
16
  # Function to initialize the Gemini model with an event loop
17
  async def initialize_llm():
 
125
  expected_output=(
126
  "An updated resume that effectively highlights the candidate's qualifications and experiences relevant to the job."
127
  ),
128
+ output_file="tailored_resume.md",
129
  context=[research_task, profile_task],
130
  agent=resume_strategist
131
  )
 
139
  expected_output=(
140
  "A document containing key questions and talking points that the candidate should prepare for the initial interview."
141
  ),
142
+ output_file="interview_materials.md",
143
  context=[research_task, profile_task, resume_strategy_task],
144
  agent=interview_preparer
145
  )
 
160
  }
161
 
162
  # Running Tasks
163
+ try:
164
+ # Assuming job_application_crew.kickoff is an async function
165
+ results = await job_application_crew.kickoff(inputs=job_application_inputs)
166
+
167
+ # Print type and contents for debugging
168
+ st.write("Type of results:", type(results))
169
+ st.write("Contents of results:", results)
170
+
171
+ # Check if results is a dictionary
172
+ if isinstance(results, dict):
173
+ # Display results based on their expected keys
174
+ st.write("Job Requirements:", results.get('job_requirements', 'No job requirements found'))
175
+ st.write("Personal Profile:", results.get('personal_profile', 'No personal profile found'))
176
+ st.write("Tailored Resume:", results.get('tailored_resume', 'No tailored resume found'))
177
+ st.write("Interview Materials:", results.get('interview_materials', 'No interview materials found'))
178
+ else:
179
+ st.write("Unexpected results format:", results)
180
+ except Exception as e:
181
+ st.error(f"An error occurred: {e}")