Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,33 +1,30 @@
|
|
| 1 |
-
|
| 2 |
from model import extract_text_from_pdf, analyze_resume
|
| 3 |
import os
|
| 4 |
|
| 5 |
-
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
return render_template("index.html")
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
if "resume" not in request.files:
|
| 14 |
-
return jsonify({"error": "No file uploaded"})
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
# Save file
|
| 22 |
-
file_path = os.path.join("uploads", file.filename)
|
| 23 |
-
file.save(file_path)
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
|
| 27 |
-
analysis = analyze_resume(
|
| 28 |
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
|
| 32 |
-
os.
|
| 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)
|
|
|