chelouche9 commited on
Commit
5cf4465
Β·
1 Parent(s): e88040b

feat: add seniority and assignment

Browse files
Files changed (1) hide show
  1. app.py +28 -10
app.py CHANGED
@@ -7,25 +7,36 @@ import shutil
7
  from openai import OpenAI
8
  import dotenv
9
 
10
- def generate_prompt(repo_url, role, repo_data, focus_areas=""):
11
  """Generates the AI analysis prompt with repo details."""
12
  return f"""
13
  You are an AI expert in evaluating software engineering candidates based on their GitHub repositories. Your goal is to assess the quality, organization, and best practices of the submitted code repository. Below is the candidate's information:
14
 
15
  ### Candidate Information:
16
  - **Role Applied For**: {role}
 
17
  - **GitHub Repository URL**: {repo_url}
18
- - **Optional Key Focus Areas**: {focus_areas}
 
 
 
 
 
 
 
19
 
20
  ### Repository Analysis:
21
  You are provided with the repository's cloned structure and its contents. Analyze the following aspects:
22
  {repo_data}
23
 
24
- 1. **Code Organization & Architecture** (20 points)
25
- 2. **Code Quality & Best Practices** (25 points)
26
- 3. **Language Proficiency & Best Practices** (20 points)
27
- 4. **Use of Frameworks & Libraries** (15 points)
28
- 5. **Testing & Documentation** (20 points)
 
 
 
29
 
30
  ### **Final Score Calculation**
31
  - Score the repository **out of 100** based on the criteria above.
@@ -50,7 +61,7 @@ def authenticate(password):
50
  return "❌ Incorrect password! Access denied.", None
51
  return None, "βœ… Access granted! You may proceed."
52
 
53
- def analyze_repo(repo_url, role, focus_areas, password):
54
  auth_error, auth_success = authenticate(password)
55
  if auth_error:
56
  return auth_error, gr.update(visible=False) # If incorrect password, return error
@@ -101,7 +112,7 @@ def analyze_repo(repo_url, role, focus_areas, password):
101
  messages=[
102
  {
103
  "role": "user",
104
- "content": generate_prompt(repo_url, role, repo_data, focus_areas)
105
  }
106
  ]
107
  )
@@ -123,6 +134,13 @@ with gr.Blocks() as app:
123
 
124
  password = gr.Textbox(label="Enter Password")
125
  role = gr.Textbox(label="Role the Candidate is Applying For")
 
 
 
 
 
 
 
126
  repo_url = gr.Textbox(label="GitHub Repository URL")
127
  focus_areas = gr.Textbox(label="Optional Focus Areas (e.g., Clean Code, Performance)")
128
 
@@ -133,7 +151,7 @@ with gr.Blocks() as app:
133
 
134
  submit_btn.click(
135
  fn=analyze_repo,
136
- inputs=[repo_url, role, focus_areas, password],
137
  outputs=[output, progress]
138
  )
139
 
 
7
  from openai import OpenAI
8
  import dotenv
9
 
10
+ def generate_prompt(repo_url, role, seniority, assignment_details, repo_data, focus_areas=""):
11
  """Generates the AI analysis prompt with repo details."""
12
  return f"""
13
  You are an AI expert in evaluating software engineering candidates based on their GitHub repositories. Your goal is to assess the quality, organization, and best practices of the submitted code repository. Below is the candidate's information:
14
 
15
  ### Candidate Information:
16
  - **Role Applied For**: {role}
17
+ - **Seniority Level**: {seniority}
18
  - **GitHub Repository URL**: {repo_url}
19
+
20
+ ### Guidelines:
21
+ - Focus on the candidate's ability to write clean, efficient, and maintainable code.
22
+ - Take into consideration the seniority level when evaluating the code.
23
+ - Focus on the assignment details provided. What was requested of him and how he responded to it.
24
+
25
+ ### Assignment Details:
26
+ {assignment_details}
27
 
28
  ### Repository Analysis:
29
  You are provided with the repository's cloned structure and its contents. Analyze the following aspects:
30
  {repo_data}
31
 
32
+ ### Additional Evaluation Criteria:
33
+ 1. **Code Organization & Architecture**
34
+ 2. **Code Quality & Best Practices**
35
+ 3. **Language Proficiency & Best Practices**
36
+ 4. **Use of Frameworks & Libraries**
37
+
38
+ ### Optional Key Focus Areas:
39
+ {focus_areas}
40
 
41
  ### **Final Score Calculation**
42
  - Score the repository **out of 100** based on the criteria above.
 
61
  return "❌ Incorrect password! Access denied.", None
62
  return None, "βœ… Access granted! You may proceed."
63
 
64
+ def analyze_repo(repo_url, role, seniority, assignment_details, focus_areas, password):
65
  auth_error, auth_success = authenticate(password)
66
  if auth_error:
67
  return auth_error, gr.update(visible=False) # If incorrect password, return error
 
112
  messages=[
113
  {
114
  "role": "user",
115
+ "content": generate_prompt(repo_url, role, seniority, assignment_details, repo_data, focus_areas)
116
  }
117
  ]
118
  )
 
134
 
135
  password = gr.Textbox(label="Enter Password")
136
  role = gr.Textbox(label="Role the Candidate is Applying For")
137
+ seniority = gr.Dropdown(
138
+ ["Junior", "Mid", "Senior"],
139
+ label="Seniority Level",
140
+ value="Mid"
141
+
142
+ )
143
+ assignment_details = gr.Textbox(label="Assignment Details", lines=8)
144
  repo_url = gr.Textbox(label="GitHub Repository URL")
145
  focus_areas = gr.Textbox(label="Optional Focus Areas (e.g., Clean Code, Performance)")
146
 
 
151
 
152
  submit_btn.click(
153
  fn=analyze_repo,
154
+ inputs=[repo_url, role, seniority, assignment_details, focus_areas, password],
155
  outputs=[output, progress]
156
  )
157