Update main.py
Browse files
main.py
CHANGED
@@ -97,16 +97,25 @@ async def get_data(input_file: UploadFile = File(...)):
|
|
97 |
text = vision(file_content)
|
98 |
else:
|
99 |
raise HTTPException(status_code=400, detail="Unsupported file type")
|
100 |
-
|
101 |
# Call Gemini (or another model) to extract required data
|
102 |
prompt = f"""This is CV data: {text.strip()}
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
response = model_text.generate_content(prompt)
|
|
|
110 |
data = json.loads(response.text.replace("```json", "").replace("```", ""))
|
111 |
return {"data": data}
|
112 |
|
|
|
97 |
text = vision(file_content)
|
98 |
else:
|
99 |
raise HTTPException(status_code=400, detail="Unsupported file type")
|
100 |
+
|
101 |
# Call Gemini (or another model) to extract required data
|
102 |
prompt = f"""This is CV data: {text.strip()}
|
103 |
+
IMPORTANT: The output should be a JSON array! Make Sure the JSON is valid.
|
104 |
+
|
105 |
+
Example Output:
|
106 |
+
[
|
107 |
+
"firstname" : firstname,
|
108 |
+
"lastname" : lastname,
|
109 |
+
"contact_number" : contact number
|
110 |
+
"total_years_of_experience" : total years of experience,
|
111 |
+
"LinkedIn_link" : LinkedIn link,
|
112 |
+
"experience" : experience,
|
113 |
+
"skills" : skills
|
114 |
+
]
|
115 |
+
"""
|
116 |
|
117 |
response = model_text.generate_content(prompt)
|
118 |
+
print(response.text)
|
119 |
data = json.loads(response.text.replace("```json", "").replace("```", ""))
|
120 |
return {"data": data}
|
121 |
|