robertselvam commited on
Commit
f83ca37
1 Parent(s): 8940745

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +80 -11
app.py CHANGED
@@ -140,6 +140,56 @@ class Resume_Overall:
140
 
141
  job_list = self._generate_job_list(resume_text)
142
  return job_list
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  def show_file(self,file_path):
144
  return file_path.name
145
 
@@ -153,20 +203,24 @@ class Resume_Overall:
153
  upload_button = gr.UploadButton(
154
  "Browse File",file_types=[".txt", ".pdf", ".doc", ".docx",".json",".csv"],
155
  elem_classes="uploadbutton")
156
- with gr.Row("col-container"):
157
- with gr.TabItem("Designation"):
 
158
  btn = gr.Button(value="Submit")
159
  output_text = gr.Textbox(label="Designation List")
160
- with gr.TabItem("Summarized"):
 
161
  analyse = gr.Button("Analyze")
162
  summary_result = gr.Textbox(label="Summarized",lines=8)
163
- with gr.TabItem("Skills and Education Gaps"):
 
164
  analyse_resume = gr.Button("Analyze Resume")
165
  result = gr.Textbox(label="Skills and Education Gaps",lines=8)
166
- with gr.TabItem("Course"):
 
167
  course_analyse = gr.Button("Find Courses")
168
  course_result = gr.Textbox(label="Suggested Cources",lines=8)
169
-
170
  upload_button.upload(self.show_file,upload_button,file_output)
171
  course_analyse.click(self.course_response, [upload_button], course_result)
172
  analyse_resume.click(self.skill_response, [upload_button], result)
@@ -181,11 +235,26 @@ class Resume_Overall:
181
  upload_button1 = gr.UploadButton(
182
  "Browse File",file_types=[".txt", ".pdf", ".doc", ".docx",".json",".csv"],
183
  elem_classes="uploadbutton")
184
- with gr.Row():
185
- with gr.TabItem("Designation"):
186
- btn1 = gr.Button(value="Submit")
187
- output_text1 = gr.Textbox(label="Designation List")
188
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  app.launch(debug=True)
190
 
191
  if __name__ == "__main__":
 
140
 
141
  job_list = self._generate_job_list(resume_text)
142
  return job_list
143
+
144
+ def generate_job_description(self, role, experience):
145
+ # Generate a response from the GPT-3 model
146
+
147
+ prompt = f"""Your task is generate Job description for this {role} with {experience} years of experience.
148
+ Job Description Must have
149
+ 1. Job Title
150
+ 2. Job Summary : [200 words]
151
+ 3. Responsibilities : Five Responsibilities in five lines
152
+ 4. Required Skills : Six Skills
153
+ 5. Qualifications
154
+ These topics must have in that Generated Job Description.
155
+ """
156
+ response = openai.Completion.create(
157
+ engine='text-davinci-003', # Choose the GPT-3 engine you want to use
158
+ prompt=prompt,
159
+ max_tokens=500, # Set the maximum number of tokens in the generated response
160
+ temperature=0.5, # Controls the randomness of the output. Higher values = more random, lower values = more focused
161
+ )
162
+
163
+ # Extract the generated text from the API response
164
+ generated_text = response.choices[0].text.strip()
165
+
166
+ return generated_text
167
+
168
+ def response(self,job_description_path):
169
+ job_description_path = job_description_path.name
170
+ job_description = self.extract_text_from_file(job_description_path)
171
+
172
+
173
+ # Define the prompt or input for the model
174
+ prompt = f"""Generate interview questions for screening following job_description delimitted by triple backticks. Generate atmost ten questions.
175
+ ```{job_description}```
176
+ """
177
+
178
+ # Generate a response from the GPT-3 model
179
+ response = openai.Completion.create(
180
+ engine='text-davinci-003', # Choose the GPT-3 engine you want to use
181
+ prompt=prompt,
182
+ max_tokens=200, # Set the maximum number of tokens in the generated response
183
+ temperature=0, # Controls the randomness of the output. Higher values = more random, lower values = more focused
184
+ n=1, # Generate a single response
185
+ stop=None, # Specify an optional stop sequence to limit the length of the response
186
+ )
187
+
188
+ # Extract the generated text from the API response
189
+ generated_text = response.choices[0].text.strip()
190
+
191
+ return generated_text
192
+
193
  def show_file(self,file_path):
194
  return file_path.name
195
 
 
203
  upload_button = gr.UploadButton(
204
  "Browse File",file_types=[".txt", ".pdf", ".doc", ".docx",".json",".csv"],
205
  elem_classes="uploadbutton")
206
+
207
+ with gr.TabItem("Designation"):
208
+ with gr.Column(elem_id = "col-container",scale=0.80):
209
  btn = gr.Button(value="Submit")
210
  output_text = gr.Textbox(label="Designation List")
211
+ with gr.TabItem("Summarized"):
212
+ with gr.Column(elem_id = "col-container",scale=0.80):
213
  analyse = gr.Button("Analyze")
214
  summary_result = gr.Textbox(label="Summarized",lines=8)
215
+ with gr.TabItem("Skills and Education Gaps"):
216
+ with gr.Column(elem_id = "col-container",scale=0.80):
217
  analyse_resume = gr.Button("Analyze Resume")
218
  result = gr.Textbox(label="Skills and Education Gaps",lines=8)
219
+ with gr.TabItem("Course"):
220
+ with gr.Column(elem_id = "col-container",scale=0.80):
221
  course_analyse = gr.Button("Find Courses")
222
  course_result = gr.Textbox(label="Suggested Cources",lines=8)
223
+
224
  upload_button.upload(self.show_file,upload_button,file_output)
225
  course_analyse.click(self.course_response, [upload_button], course_result)
226
  analyse_resume.click(self.skill_response, [upload_button], result)
 
235
  upload_button1 = gr.UploadButton(
236
  "Browse File",file_types=[".txt", ".pdf", ".doc", ".docx",".json",".csv"],
237
  elem_classes="uploadbutton")
238
+ with gr.TabItem("Screening Question"):
239
+ with gr.Row():
240
+ with gr.TabItem("Screening Question"):
241
+ jd_btn = gr.Button(value="Submit")
242
+ output_text1 = gr.Textbox(label="Screening Question")
243
+ with gr.TabItem("Screening Question"):
244
+ with gr.Row():
245
+ with gr.Column():
246
+ rolls = gr.Textbox(label="Role")
247
+ with gr.Column():
248
+ experience = gr.Textbox(label="Experience")
249
+ with gr.Row():
250
+ get_jd_btn = gr.Button("Generate JD")
251
+ with gr.Row():
252
+ result_jd = gr.Textbox(label="Job Description",lines=8)
253
+
254
+ get_jd_btn.click(self.generate_job_description, [rolls,experience], result_jd)
255
+ upload_button1.upload(self.show_file,upload_button1,file_output1)
256
+ jd_btn.click(self.response,[upload_button1], output_text1)
257
+
258
  app.launch(debug=True)
259
 
260
  if __name__ == "__main__":