Fixed Major Issues
Browse files- Dockerfile +0 -7
- Required Data/Resume.pdf +3 -0
- app.py +9 -8
Dockerfile
CHANGED
|
@@ -1,20 +1,13 @@
|
|
| 1 |
-
# Use a modern, lightweight Python version
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
# Set the working directory in the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Copy the requirements file first to leverage Docker cache
|
| 8 |
COPY requirements.txt .
|
| 9 |
|
| 10 |
-
# Install Python dependencies
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
| 13 |
-
# Copy the rest of the application's code into the container
|
| 14 |
COPY . .
|
| 15 |
|
| 16 |
-
# Expose the port that Hugging Face expects
|
| 17 |
EXPOSE 7860
|
| 18 |
|
| 19 |
-
# Run the app using a production-ready server (Gunicorn)
|
| 20 |
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
COPY requirements.txt .
|
| 6 |
|
|
|
|
| 7 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 8 |
|
|
|
|
| 9 |
COPY . .
|
| 10 |
|
|
|
|
| 11 |
EXPOSE 7860
|
| 12 |
|
|
|
|
| 13 |
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
|
Required Data/Resume.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:285138a988bc48546637d36a93d903fd10ef68e62b0d38e7283173b03d8635cf
|
| 3 |
+
size 52610
|
app.py
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import json
|
| 2 |
import re
|
| 3 |
import logging
|
| 4 |
import math
|
| 5 |
-
import os
|
| 6 |
import docx
|
| 7 |
import fitz # PyMuPDF
|
| 8 |
from dotenv import load_dotenv
|
|
@@ -12,10 +17,6 @@ from sentence_transformers import SentenceTransformer, util
|
|
| 12 |
from rapidfuzz import fuzz, process
|
| 13 |
from urllib.parse import quote_plus
|
| 14 |
|
| 15 |
-
# --- Set Cache Folders for Hugging Face Environment ---
|
| 16 |
-
os.environ["TRANSFORMERS_CACHE"] = "/tmp/transformers"
|
| 17 |
-
os.environ["HF_HOME"] = "/tmp/huggingface"
|
| 18 |
-
|
| 19 |
# --- Load environment variables and configure Gemini API ---
|
| 20 |
load_dotenv()
|
| 21 |
GEMINI_API_KEY = os.getenv("GEMINI_API_KEY")
|
|
@@ -167,7 +168,6 @@ def get_recommendations(answers, courses):
|
|
| 167 |
raw_recs = [course for _, course in top_courses]
|
| 168 |
if not raw_recs: return "🤔 I couldn’t find a strong match. Would you like to try again?", []
|
| 169 |
|
| 170 |
-
# --- THIS IS THE MODIFIED PART ---
|
| 171 |
response_html = "<div class='recommendation-container'><h4>🚀 Here are my top recommendations for you:</h4>"
|
| 172 |
for i, (_, course_data) in enumerate(top_courses):
|
| 173 |
course_name = course_data.get('course')
|
|
@@ -186,8 +186,7 @@ def get_recommendations(answers, courses):
|
|
| 186 |
response_html += "</div>"
|
| 187 |
|
| 188 |
response_html += "</div>"
|
| 189 |
-
|
| 190 |
-
|
| 191 |
response_html += f"<div class='recommendation-card clickable-card compare-card' data-action='compare' data-value='compare'><p><b>⚖️ Compare Courses</b></p></div></div>"
|
| 192 |
return response_html, raw_recs
|
| 193 |
|
|
@@ -220,7 +219,9 @@ def analyze_resume_and_suggest_jobs(resume_text):
|
|
| 220 |
2. "overall_score": An integer score out of 100 for the resume's quality.
|
| 221 |
3. "summary": A brief, encouraging 1-2 sentence summary of the resume.
|
| 222 |
4. "job_titles": A list of 3-5 specific job titles the candidate is well-suited for based on their skills and experience.
|
|
|
|
| 223 |
Do not add any text before or after the JSON object.
|
|
|
|
| 224 |
Resume Text to analyze:
|
| 225 |
---
|
| 226 |
{resume_text}
|
|
|
|
| 1 |
+
# --- Set Cache Folders for Hugging Face Environment ---
|
| 2 |
+
# THIS IS THE CRUCIAL FIX for the PermissionError. It must be at the top.
|
| 3 |
+
import os
|
| 4 |
+
os.environ["TRANSFORMERS_CACHE"] = "/tmp/transformers"
|
| 5 |
+
os.environ["HF_HOME"] = "/tmp/huggingface"
|
| 6 |
+
|
| 7 |
import json
|
| 8 |
import re
|
| 9 |
import logging
|
| 10 |
import math
|
|
|
|
| 11 |
import docx
|
| 12 |
import fitz # PyMuPDF
|
| 13 |
from dotenv import load_dotenv
|
|
|
|
| 17 |
from rapidfuzz import fuzz, process
|
| 18 |
from urllib.parse import quote_plus
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
# --- Load environment variables and configure Gemini API ---
|
| 21 |
load_dotenv()
|
| 22 |
GEMINI_API_KEY = os.getenv("GEMINI_API_KEY")
|
|
|
|
| 168 |
raw_recs = [course for _, course in top_courses]
|
| 169 |
if not raw_recs: return "🤔 I couldn’t find a strong match. Would you like to try again?", []
|
| 170 |
|
|
|
|
| 171 |
response_html = "<div class='recommendation-container'><h4>🚀 Here are my top recommendations for you:</h4>"
|
| 172 |
for i, (_, course_data) in enumerate(top_courses):
|
| 173 |
course_name = course_data.get('course')
|
|
|
|
| 186 |
response_html += "</div>"
|
| 187 |
|
| 188 |
response_html += "</div>"
|
| 189 |
+
|
|
|
|
| 190 |
response_html += f"<div class='recommendation-card clickable-card compare-card' data-action='compare' data-value='compare'><p><b>⚖️ Compare Courses</b></p></div></div>"
|
| 191 |
return response_html, raw_recs
|
| 192 |
|
|
|
|
| 219 |
2. "overall_score": An integer score out of 100 for the resume's quality.
|
| 220 |
3. "summary": A brief, encouraging 1-2 sentence summary of the resume.
|
| 221 |
4. "job_titles": A list of 3-5 specific job titles the candidate is well-suited for based on their skills and experience.
|
| 222 |
+
|
| 223 |
Do not add any text before or after the JSON object.
|
| 224 |
+
|
| 225 |
Resume Text to analyze:
|
| 226 |
---
|
| 227 |
{resume_text}
|