Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
from crewai import Agent, Task, Crew, Process
|
3 |
-
from
|
4 |
import os
|
5 |
import fitz # PyMuPDF for PDF handling
|
6 |
import tempfile
|
@@ -38,11 +38,13 @@ def wrap_text(text, width=80):
|
|
38 |
def create_crew(job_description, resume_text):
|
39 |
"""Creates the CrewAI crew with agents and tasks."""
|
40 |
|
41 |
-
#
|
42 |
-
llm =
|
43 |
-
|
44 |
-
|
45 |
temperature=0.7,
|
|
|
|
|
46 |
)
|
47 |
|
48 |
# 1. Resume Analyzer Agent
|
@@ -54,7 +56,7 @@ def create_crew(job_description, resume_text):
|
|
54 |
identifying key skills, experiences, and formatting issues.""",
|
55 |
verbose=True,
|
56 |
allow_delegation=False,
|
57 |
-
llm=llm
|
58 |
)
|
59 |
|
60 |
# 2. Job Description Analyzer Agent
|
@@ -95,7 +97,7 @@ def create_crew(job_description, resume_text):
|
|
95 |
--------------
|
96 |
""",
|
97 |
agent=resume_analyzer,
|
98 |
-
expected_output="A structured report summarizing the resume's strengths, weaknesses, key skills, and areas for improvement."
|
99 |
)
|
100 |
|
101 |
# Task 2: Analyze the Job Description
|
@@ -109,7 +111,7 @@ def create_crew(job_description, resume_text):
|
|
109 |
--------------
|
110 |
""",
|
111 |
agent=job_analyzer,
|
112 |
-
expected_output="A structured summary of the job description, including key requirements, desired skills, qualifications, and important keywords."
|
113 |
)
|
114 |
|
115 |
# Task 3: Suggest Improvements
|
@@ -125,15 +127,15 @@ def create_crew(job_description, resume_text):
|
|
125 |
The job description analysis is: {task_analyze_job_description.output}
|
126 |
""",
|
127 |
agent=improvement_suggestor,
|
128 |
-
expected_output="A list of specific, actionable suggestions for improving the resume, covering content, keywords, formatting, and overall strategy, tailored to the job description."
|
129 |
)
|
130 |
|
131 |
# --- Crew ---
|
132 |
crew = Crew(
|
133 |
agents=[resume_analyzer, job_analyzer, improvement_suggestor],
|
134 |
tasks=[task_analyze_resume, task_analyze_job_description, task_suggest_improvements],
|
135 |
-
verbose=True,
|
136 |
-
process=Process.sequential
|
137 |
)
|
138 |
|
139 |
return crew
|
@@ -157,7 +159,7 @@ if st.button("Tailor Resume"):
|
|
157 |
crew = create_crew(job_description, resume_text)
|
158 |
result = crew.kickoff()
|
159 |
st.subheader("Suggested Improvements:")
|
160 |
-
st.write(wrap_text(result))
|
161 |
else:
|
162 |
st.error("Failed to read the resume content.")
|
163 |
|
|
|
1 |
import streamlit as st
|
2 |
from crewai import Agent, Task, Crew, Process
|
3 |
+
from langchain_google_genai import ChatGoogleGenerativeAI # Import ChatGoogleGenerativeAI
|
4 |
import os
|
5 |
import fitz # PyMuPDF for PDF handling
|
6 |
import tempfile
|
|
|
38 |
def create_crew(job_description, resume_text):
|
39 |
"""Creates the CrewAI crew with agents and tasks."""
|
40 |
|
41 |
+
# Gemini LLM configuration using ChatGoogleGenerativeAI
|
42 |
+
llm = ChatGoogleGenerativeAI(
|
43 |
+
model="gemini-1.5-flash-002", # Specify the Gemini 1.5 Flash model
|
44 |
+
google_api_key=os.environ.get("GOOGLE_API_KEY"), # Use GOOGLE_API_KEY
|
45 |
temperature=0.7,
|
46 |
+
convert_system_message_to_human=True #Need this to work well with CrewAI
|
47 |
+
|
48 |
)
|
49 |
|
50 |
# 1. Resume Analyzer Agent
|
|
|
56 |
identifying key skills, experiences, and formatting issues.""",
|
57 |
verbose=True,
|
58 |
allow_delegation=False,
|
59 |
+
llm=llm
|
60 |
)
|
61 |
|
62 |
# 2. Job Description Analyzer Agent
|
|
|
97 |
--------------
|
98 |
""",
|
99 |
agent=resume_analyzer,
|
100 |
+
expected_output="A structured report summarizing the resume's strengths, weaknesses, key skills, and areas for improvement."
|
101 |
)
|
102 |
|
103 |
# Task 2: Analyze the Job Description
|
|
|
111 |
--------------
|
112 |
""",
|
113 |
agent=job_analyzer,
|
114 |
+
expected_output="A structured summary of the job description, including key requirements, desired skills, qualifications, and important keywords."
|
115 |
)
|
116 |
|
117 |
# Task 3: Suggest Improvements
|
|
|
127 |
The job description analysis is: {task_analyze_job_description.output}
|
128 |
""",
|
129 |
agent=improvement_suggestor,
|
130 |
+
expected_output="A list of specific, actionable suggestions for improving the resume, covering content, keywords, formatting, and overall strategy, tailored to the job description."
|
131 |
)
|
132 |
|
133 |
# --- Crew ---
|
134 |
crew = Crew(
|
135 |
agents=[resume_analyzer, job_analyzer, improvement_suggestor],
|
136 |
tasks=[task_analyze_resume, task_analyze_job_description, task_suggest_improvements],
|
137 |
+
verbose=True,
|
138 |
+
process=Process.sequential
|
139 |
)
|
140 |
|
141 |
return crew
|
|
|
159 |
crew = create_crew(job_description, resume_text)
|
160 |
result = crew.kickoff()
|
161 |
st.subheader("Suggested Improvements:")
|
162 |
+
st.write(wrap_text(result))
|
163 |
else:
|
164 |
st.error("Failed to read the resume content.")
|
165 |
|