Nassira commited on
Commit
9371610
·
verified ·
1 Parent(s): 069431d

Create cv_prompt.py

Browse files
Files changed (1) hide show
  1. cv_prompt.py +18 -0
cv_prompt.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+
3
+ # Load the JSON file
4
+ with open('cv_sections.json', 'r') as f:
5
+ cv_sections_data = json.load(f)
6
+
7
+ def get_cv_prompt(text):
8
+ sections_list = ", ".join(cv_sections_data["sections"].keys())
9
+ return f"""<s>[INST] Analyze this CV text in any language. Return a JSON object with key "present_sections" containing an array of sections present from this list: {sections_list}. A section is present if its content is identifiable, even without an explicit title. Consider synonyms and alternative phrasings in any language.
10
+
11
+ CV text:
12
+ {text}
13
+
14
+ Respond only with the JSON object, no explanation. [/INST]"""
15
+
16
+ def get_location_prompt(text):
17
+ return f"""Extract the city and country from the following text. Respond in the format 'City: [city name], Country: [country name]'. If you can't find the information, respond with 'Not found'. Here's the text:
18
+ {text}"""