ilsa15 commited on
Commit
db9b92c
·
verified ·
1 Parent(s): fda0ecd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -1,4 +1,3 @@
1
-
2
  import streamlit as st
3
  import os
4
  import faiss
@@ -7,11 +6,12 @@ import PyPDF2
7
  from sentence_transformers import SentenceTransformer
8
  from groq import Groq
9
 
10
- # Set Groq API key
11
  GROQ_API_KEY = os.getenv("GROQ_API_KEY")
12
  groq_client = Groq(api_key=GROQ_API_KEY)
13
 
14
- embedder = SentenceTransformer("all-MiniLM-L6-v2")
 
15
 
16
  # Example job descriptions
17
  job_data = {
@@ -36,13 +36,13 @@ def find_best_job_match(resume_text):
36
 
37
  def query_llm(context, question):
38
  prompt = f"""You are an expert job coach. Based on the resume below and the job context:
39
-
40
  Context: {context}
41
 
42
  Resume: {question}
43
 
44
  Give a simple analysis of how well this resume fits and what's missing."""
45
-
46
  response = groq_client.chat.completions.create(
47
  model="llama-3-8b-8192",
48
  messages=[{"role": "user", "content": prompt}]
@@ -68,4 +68,4 @@ if uploaded_file:
68
  st.subheader("🧾 AI Feedback:")
69
  st.write(response)
70
 
71
- st.info("This app is for guidance only. Tailor your resume per job posting!")
 
 
1
  import streamlit as st
2
  import os
3
  import faiss
 
6
  from sentence_transformers import SentenceTransformer
7
  from groq import Groq
8
 
9
+ # Set Groq API key from environment variable
10
  GROQ_API_KEY = os.getenv("GROQ_API_KEY")
11
  groq_client = Groq(api_key=GROQ_API_KEY)
12
 
13
+ # Use a compatible SentenceTransformer model for Hugging Face Spaces
14
+ embedder = SentenceTransformer("paraphrase-MiniLM-L6-v2", device='cpu')
15
 
16
  # Example job descriptions
17
  job_data = {
 
36
 
37
  def query_llm(context, question):
38
  prompt = f"""You are an expert job coach. Based on the resume below and the job context:
39
+
40
  Context: {context}
41
 
42
  Resume: {question}
43
 
44
  Give a simple analysis of how well this resume fits and what's missing."""
45
+
46
  response = groq_client.chat.completions.create(
47
  model="llama-3-8b-8192",
48
  messages=[{"role": "user", "content": prompt}]
 
68
  st.subheader("🧾 AI Feedback:")
69
  st.write(response)
70
 
71
+ st.info("This app is for guidance only. Tailor your resume per job posting!")