Update main.py
Browse files
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 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
Example Output:
|
101 |
```json
|
102 |
-
|
103 |
-
"firstname": "
|
104 |
-
"lastname": "
|
105 |
-
"email": "
|
106 |
-
"contact_number": "
|
107 |
-
"home_address": "
|
108 |
-
"home_town": "
|
109 |
-
"total_years_of_experience": "
|
110 |
-
"education": "Institution Name,
|
111 |
-
"LinkedIn_link": "LinkedIn
|
112 |
-
"experience": "
|
113 |
"industry": "industry of work",
|
114 |
-
"skills": "
|
115 |
-
"positions": ["Job
|
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 |
|