jeellyfish commited on
Commit
82fd01c
·
verified ·
1 Parent(s): 807dc24

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -18
app.py CHANGED
@@ -1,43 +1,39 @@
1
  import gradio as gr
2
- from owl.agents import Agent
3
 
4
  # Job Search Agent
5
- class JobSearchAgent(Agent):
6
  def __init__(self):
7
  super().__init__(
8
  role="Job Search Agent",
9
- goal="Find job postings",
10
- tools=[], # No RedditToolkit to avoid API setup
11
- llm=None # No LLM to simplify; mock search logic instead
12
  )
13
 
14
  def search_jobs(self, keywords):
15
- # Mock search results (replace with real toolkit logic later if needed)
16
  return [f"Job: {keywords} Developer at MockCorp",
17
  f"Job: Senior {keywords} Engineer at TestInc"]
18
 
19
  # Resume Tailoring Agent
20
- class ResumeTailoringAgent(Agent):
21
  def __init__(self):
22
  super().__init__(
23
  role="Resume Tailoring Agent",
24
- goal="Suggest resume keywords",
25
- tools=[],
26
- llm=None # No LLM; use simple text processing
27
  )
28
 
29
  def suggest_keywords(self, job_description, resume):
30
- # Simple keyword extraction (mocked for demo)
31
  job_words = set(job_description.lower().split())
32
  resume_words = set(resume.lower().split())
33
  missing = job_words - resume_words
34
- return list(missing)[:5] # Limit to 5 suggestions
35
 
36
- # Initialize agents
37
  job_search_agent = JobSearchAgent()
38
  resume_tailoring_agent = ResumeTailoringAgent()
39
 
40
- # Gradio functions
41
  def search_jobs(keywords):
42
  try:
43
  results = job_search_agent.search_jobs(keywords)
@@ -52,9 +48,9 @@ def tailor_resume(job_desc, resume):
52
  except Exception as e:
53
  return f"Error: {str(e)}"
54
 
55
- # Gradio interface
56
  with gr.Blocks() as demo:
57
- gr.Markdown("# Autonomous Job Search and Prep Companion")
58
 
59
  with gr.Tab("Job Search"):
60
  keywords = gr.Textbox(label="Enter keywords (e.g., Python)")
@@ -63,8 +59,8 @@ with gr.Blocks() as demo:
63
  search_btn.click(search_jobs, inputs=keywords, outputs=job_output)
64
 
65
  with gr.Tab("Resume Tailoring"):
66
- job_desc = gr.Textbox(label="Job Description", lines=3)
67
- resume = gr.Textbox(label="Your Resume", lines=3)
68
  tailor_btn = gr.Button("Get Suggestions")
69
  suggestions = gr.Textbox(label="Suggestions")
70
  tailor_btn.click(tailor_resume, inputs=[job_desc, resume], outputs=suggestions)
 
1
  import gradio as gr
2
+ from camel.agents import AssistantAgent, UserAgent
3
 
4
  # Job Search Agent
5
+ class JobSearchAgent(AssistantAgent):
6
  def __init__(self):
7
  super().__init__(
8
  role="Job Search Agent",
9
+ description="Finds job postings based on user keywords."
 
 
10
  )
11
 
12
  def search_jobs(self, keywords):
13
+ # Mock job search results (no external APIs)
14
  return [f"Job: {keywords} Developer at MockCorp",
15
  f"Job: Senior {keywords} Engineer at TestInc"]
16
 
17
  # Resume Tailoring Agent
18
+ class ResumeTailoringAgent(AssistantAgent):
19
  def __init__(self):
20
  super().__init__(
21
  role="Resume Tailoring Agent",
22
+ description="Suggests keywords to improve a resume based on a job description."
 
 
23
  )
24
 
25
  def suggest_keywords(self, job_description, resume):
26
+ # Simple mock logic to suggest keywords
27
  job_words = set(job_description.lower().split())
28
  resume_words = set(resume.lower().split())
29
  missing = job_words - resume_words
30
+ return list(missing)[:5] # Return top 5 missing keywords
31
 
32
+ # Initialize the agents
33
  job_search_agent = JobSearchAgent()
34
  resume_tailoring_agent = ResumeTailoringAgent()
35
 
36
+ # Gradio interface functions
37
  def search_jobs(keywords):
38
  try:
39
  results = job_search_agent.search_jobs(keywords)
 
48
  except Exception as e:
49
  return f"Error: {str(e)}"
50
 
51
+ # Build the Gradio UI
52
  with gr.Blocks() as demo:
53
+ gr.Markdown("# Autonomous Job Search and Prep Companion (CAMEL-AI)")
54
 
55
  with gr.Tab("Job Search"):
56
  keywords = gr.Textbox(label="Enter keywords (e.g., Python)")
 
59
  search_btn.click(search_jobs, inputs=keywords, outputs=job_output)
60
 
61
  with gr.Tab("Resume Tailoring"):
62
+ job_desc = gr.Textbox(label="Paste Job Description", lines=3)
63
+ resume = gr.Textbox(label="Paste Your Resume", lines=3)
64
  tailor_btn = gr.Button("Get Suggestions")
65
  suggestions = gr.Textbox(label="Suggestions")
66
  tailor_btn.click(tailor_resume, inputs=[job_desc, resume], outputs=suggestions)