Nasma commited on
Commit
2925c24
·
verified ·
1 Parent(s): 9c5580a

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +24 -20
main.py CHANGED
@@ -93,29 +93,29 @@ def get_data(input_file: UploadFile = File(...)):
93
  print("Extracted Text:\n", extracted_text.strip())
94
 
95
  # Call GPT-4o to structure extracted text into JSON format
96
- # Call GPT-4o to process extracted text into structured JSON
97
- prompt = f"""This is CV data: {text.strip()}.
98
- IMPORTANT: The output should be a JSON array! Make Sure the JSON is valid.if you not found data then fill with "none" don't add any extra explaition text
99
- need only json
100
  Example Output:
101
  ```json
102
- [
103
- "firstname": "firstname",
104
- "lastname": "lastname",
105
- "email": "email",
106
- "contact_number": "contact number",
107
- "home_address": "full home address",
108
- "home_town": "home town or city",
109
- "total_years_of_experience": "total years of experience",
110
- "education": "Institution Name, Country, Degree Name, Graduation Year; Institution Name, Country, Degree Name, Graduation Year",
111
- "LinkedIn_link": "LinkedIn link",
112
- "experience": "experience",
113
  "industry": "industry of work",
114
- "skills": "skills(Identify and list specific skills mentioned in both the skills section and inferred from the experience section), formatted as: Skill 1, Skill 2, Skill 3, Skill 4, Skill 5",
115
- "positions": ["Job title 1, Job title 2, Job title 3"]
116
- ]
117
- ```
118
- """
119
 
120
  response = openai.ChatCompletion.create(
121
  model="gpt-4o",
@@ -134,4 +134,8 @@ def get_data(input_file: UploadFile = File(...)):
134
  except Exception as e:
135
  raise HTTPException(status_code=500, detail=f"Error processing file: {str(e)}")
136
 
 
 
 
 
137
 
 
93
  print("Extracted Text:\n", extracted_text.strip())
94
 
95
  # Call GPT-4o to structure extracted text into JSON format
96
+ prompt = f"""This is CV data: {extracted_text.strip()}.
97
+ IMPORTANT: The output should be a JSON array! Make sure the JSON is valid.
98
+ If no data is found, fill missing fields with "none". Do not include extra explanation text.
99
+
100
  Example Output:
101
  ```json
102
+ {{
103
+ "firstname": "First Name",
104
+ "lastname": "Last Name",
105
+ "email": "Email Address",
106
+ "contact_number": "Contact Number",
107
+ "home_address": "Full Home Address",
108
+ "home_town": "Home Town or City",
109
+ "total_years_of_experience": "Total Years of Experience",
110
+ "education": "Institution Name, Degree Name",
111
+ "LinkedIn_link": "LinkedIn URL",
112
+ "experience": "Job Title, Start Date - End Date, Company Name; Job Title, Start Date - End Date, Company Name; Job Title, Start Date - End Date, Company Name",
113
  "industry": "industry of work",
114
+ "skills": "Skill 1, Skill 2, Skill 3",
115
+ "positions": ["Job Title 1", "Job Title 2"],
116
+ "summary": "Summary of qualifications and experience"
117
+ }}
118
+ ```"""
119
 
120
  response = openai.ChatCompletion.create(
121
  model="gpt-4o",
 
134
  except Exception as e:
135
  raise HTTPException(status_code=500, detail=f"Error processing file: {str(e)}")
136
 
137
+
138
+
139
+
140
+
141