Arafath10 commited on
Commit
e7eb65e
·
verified ·
1 Parent(s): 5354b70

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +15 -6
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
- print(text,"=========================================")
101
  # Call Gemini (or another model) to extract required data
102
  prompt = f"""This is CV data: {text.strip()}
103
- I want only:
104
-
105
- firstname, lastname, contact number, total years of experience, LinkedIn link, experience, skills
106
-
107
- in JSON format only"""
 
 
 
 
 
 
 
 
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