mutaibamohsin845 commited on
Commit
5009d78
Β·
verified Β·
1 Parent(s): 2c995f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -24
app.py CHANGED
@@ -1,33 +1,30 @@
1
- from flask import Flask, render_template, request, jsonify
2
  from model import extract_text_from_pdf, analyze_resume
3
  import os
4
 
5
- app = Flask(__name__)
6
 
7
- @app.route("/")
8
- def index():
9
- return render_template("index.html")
10
 
11
- @app.route("/upload", methods=["POST"])
12
- def upload_file():
13
- if "resume" not in request.files:
14
- return jsonify({"error": "No file uploaded"})
15
 
16
- file = request.files["resume"]
17
-
18
- if file.filename == "":
19
- return jsonify({"error": "No selected file"})
20
-
21
- # Save file
22
- file_path = os.path.join("uploads", file.filename)
23
- file.save(file_path)
24
 
25
- # Process Resume
26
- text = extract_text_from_pdf(file_path)
27
- analysis = analyze_resume(text)
28
 
29
- return jsonify(analysis)
 
 
 
 
30
 
31
- if __name__ == "__main__":
32
- os.makedirs("uploads", exist_ok=True)
33
- app.run(debug=True)
 
1
+ import streamlit as st
2
  from model import extract_text_from_pdf, analyze_resume
3
  import os
4
 
5
+ st.set_page_config(page_title="AI Resume Analyzer", layout="centered")
6
 
7
+ st.title("πŸ“„ AI Resume Analyzer")
8
+ st.write("Upload your resume (PDF) to analyze its ATS compatibility.")
 
9
 
10
+ # File Upload
11
+ uploaded_file = st.file_uploader("Upload Resume (PDF)", type=["pdf"])
 
 
12
 
13
+ if uploaded_file is not None:
14
+ # Save File Temporarily
15
+ temp_path = f"temp_{uploaded_file.name}"
16
+ with open(temp_path, "wb") as f:
17
+ f.write(uploaded_file.getbuffer())
 
 
 
18
 
19
+ # Extract & Analyze
20
+ resume_text = extract_text_from_pdf(temp_path)
21
+ analysis = analyze_resume(resume_text)
22
 
23
+ # Display Results
24
+ st.subheader("πŸ“ Resume Analysis")
25
+ st.write(f"**ATS Score:** {analysis['ats_score']}%")
26
+ st.write(f"**Matched Skills:** {', '.join(analysis['matched_skills'])}")
27
+ st.write(f"**Missing Skills:** {', '.join(analysis['missing_skills'])}")
28
 
29
+ # Clean Up
30
+ os.remove(temp_path)