srijaydeshpande commited on
Commit
45e402d
·
verified ·
1 Parent(s): a03114f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -74,13 +74,13 @@ def txt_to_html(text):
74
  html_content += "</body></html>"
75
  return html_content
76
 
77
- def craft_cv(llm, cv_text, job_description, maxtokens, temperature, top_probability):
78
- # def craft_cv(llm, prompt, maxtokens, temperature, top_probability):
79
  instruction = "Given input CV and job description. Please revise the CV according to the given job description and output the revised CV."
80
  output = llm.create_chat_completion(
81
  messages=[
82
- {"from": "user", "value": instruction + ' Input CV: ' + cv_text + ' , Job Description: ' + job_description},
83
- # {"from": "user", "value": prompt},
84
  ],
85
  max_tokens=maxtokens,
86
  temperature=temperature
@@ -153,9 +153,9 @@ def convert_to_json(llm, cv_text, maxtokens, temperature, top_probability):
153
  output = output['choices'][0]['message']['content']
154
  return output
155
 
156
- # def pdf_to_text(prompt, maxtokens=2048, temperature=0, top_probability=0.95):
157
  @spaces.GPU(duration=40)
158
- def pdf_to_text(cv_file, job_description, maxtokens=2048, temperature=0, top_probability=0.95):
 
159
 
160
  # page2content = process_document(cv_file)
161
  # cv_text = ""
@@ -172,8 +172,8 @@ def pdf_to_text(cv_file, job_description, maxtokens=2048, temperature=0, top_pro
172
  n_batch=1024,
173
  n_ctx=8192,
174
  )
175
- cv_text, crafted_cv = craft_cv(llm, cv_text, job_description, maxtokens, temperature, top_probability)
176
- # cv_text, crafted_cv = craft_cv(llm, prompt, maxtokens, temperature, top_probability)
177
  crafted_cv = convert_to_json(llm, crafted_cv, maxtokens, temperature, top_probability)
178
  return crafted_cv
179
 
@@ -185,8 +185,8 @@ prompt_text = gr.Textbox(label='Enter the job description')
185
  output_text = gr.Textbox()
186
  iface = gr.Interface(
187
  fn=pdf_to_text,
188
- inputs=[cv_file, prompt_text],
189
- # inputs=['text'],
190
  outputs=['text'],
191
  title='Craft CV',
192
  description="This application assists to customize CV based on input job description",
 
74
  html_content += "</body></html>"
75
  return html_content
76
 
77
+ # def craft_cv(llm, cv_text, job_description, maxtokens, temperature, top_probability):
78
+ def craft_cv(llm, prompt, maxtokens, temperature, top_probability):
79
  instruction = "Given input CV and job description. Please revise the CV according to the given job description and output the revised CV."
80
  output = llm.create_chat_completion(
81
  messages=[
82
+ # {"from": "user", "value": instruction + ' Input CV: ' + cv_text + ' , Job Description: ' + job_description},
83
+ {"from": "user", "value": prompt},
84
  ],
85
  max_tokens=maxtokens,
86
  temperature=temperature
 
153
  output = output['choices'][0]['message']['content']
154
  return output
155
 
 
156
  @spaces.GPU(duration=40)
157
+ def pdf_to_text(prompt, maxtokens=2048, temperature=0, top_probability=0.95):
158
+ # def pdf_to_text(cv_file, job_description, maxtokens=2048, temperature=0, top_probability=0.95):
159
 
160
  # page2content = process_document(cv_file)
161
  # cv_text = ""
 
172
  n_batch=1024,
173
  n_ctx=8192,
174
  )
175
+ # cv_text, crafted_cv = craft_cv(llm, cv_text, job_description, maxtokens, temperature, top_probability)
176
+ cv_text, crafted_cv = craft_cv(llm, prompt, maxtokens, temperature, top_probability)
177
  crafted_cv = convert_to_json(llm, crafted_cv, maxtokens, temperature, top_probability)
178
  return crafted_cv
179
 
 
185
  output_text = gr.Textbox()
186
  iface = gr.Interface(
187
  fn=pdf_to_text,
188
+ # inputs=[cv_file, prompt_text],
189
+ inputs=['text'],
190
  outputs=['text'],
191
  title='Craft CV',
192
  description="This application assists to customize CV based on input job description",