
RESUME ANALYSIS IN FastAPI
What is FastAPI?
Fastapi is a modern Python framework used to build apis. It helps us create fast, secure, and scalable backend applications. It is commonly used to build REST apis and web services.
What is an API?
API stands for Application Programming Interface. An API allows two applications to communicate with each other. For example, our frontend can send a resume to FastAPI, and FastAPI can send the resume to an AI service for analysis.
What is Resume Analysis?
Resume Analysis means checking and understanding a resume to find useful information about the candidate.It can identify things like skills, education, experience, projects, strengths, weaknesses, missing skills, and give suggestions to improve the resume.
What is API_KEY?
An API key is a secret credential that allows FastAPI application to access the Gemini API.
For example: API_KEY = "GEMINI_API_KEY"
What is GeminiAPI?
Gemini API is an API provided by Google that allows applications to communicate with Gemini AI models. It allows FastAPI application to send data such as a resume to Gemini and receive an AI-generated analysis or response.
Example code for Resume Analysis:
import base64
import requests
from fastapi import FastAPI, UploadFile, HTTPException
app = FastAPI()
API_KEY = "GEMINI_API_KEY"
@app.post("/analyze-resume")
def analyze_resume(file: UploadFile):
file_data = file.file.read()
base64_data = base64.b64encode(file_data).decode("utf-8")
url = f"https://generativelanguage.googleapis.com/v1beta/models/gemini-3.5-flash:generateContent?key={API_KEY}"
payload = {
"contents": [{
"parts": [
{
"inline_data": {
"mime_type": file.content_type or "application/pdf",
"data": base64_data
} },
{
"text": "Analyze this resume and give summary, skills, strengths, weaknesses and improvements."
} ] } ] }
response = requests.post(url, json=payload)
if response.status_code != 200:
raise HTTPException(
status_code=response.status_code,
detail=response.text
)
result = response.json()
return {
"analysis": result["candidates"][0]["content"]["parts"][0]["text"]
}
How To Run The FastAPI Server:
- Create FastAPI File: Main.py
- Write basic FastAPI code:
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def home():
return {"message": "FastAPI is running"}
- Install FastAPI and Uvicorn : pip install fastapi uvicorn
- Run the server : uvicorn main:app –reload
- Open the server : http://127.0.0.1:8000
{ "message": "FastAPI is running"}
- Open API documentation : http://127.0.0.1:8000/docs
Process of Analyzing a Resume:
- Upload Resume : The user uploads their resume, usually as a PDF file or TEXT file.
- Receive Resume : FastAPI receives the uploaded resume.
- Extract Text : The application reads the resume and converts it into text.
- Send to AI : The extracted text is sent to an AI model through an AI API.
- Analyze Resume : AI checks the skills, education, experience, projects, strengths, weaknesses, and missing skills.
- Generate Result : AI creates a resume summary, score, and improvement suggestions.
- Return Result : FastAPI sends the analysis back to the user.
Join Techsnap Creators
Share your knowledge and earn ??
Want to showcase your tech expertise and get rewarded for your insights? Join the Techsnap creator network!
Write insightful blogs, stay ahead of industry trends, and grow your professional brand while helping others in the community.
Ready to make an impact?

Comments