Dhaerie commited on
Commit
b9c5049
·
verified ·
1 Parent(s): 08a9486

Update src/app.py

Browse files
Files changed (1) hide show
  1. src/app.py +8 -10
src/app.py CHANGED
@@ -1,11 +1,14 @@
1
  import streamlit as st
2
  import os
3
- import uuid
4
  from utils import *
 
 
 
5
 
6
  if 'unique_id' not in st.session_state:
7
  st.session_state['unique_id'] = ''
8
 
 
9
  def main():
10
  st.set_page_config(page_title="Resume Screening Assistance")
11
  st.title("HR - Resume Screening Assistance...💁 ")
@@ -23,14 +26,6 @@ def main():
23
  st.error("ERROR: HUGGINGFACEHUB_API_TOKEN not found. Set it in Hugging Face Space Secrets.")
24
  return
25
 
26
- try:
27
- document_count = int(document_count)
28
- except ValueError:
29
- document_count = 5
30
-
31
- from huggingface_hub import InferenceClient
32
- hf_client = InferenceClient(token=API_TOKEN)
33
-
34
  with st.spinner('Wait for it...'):
35
  st.session_state['unique_id'] = uuid.uuid4().hex
36
  final_docs_list = create_docs(pdf, st.session_state['unique_id'])
@@ -39,8 +34,10 @@ def main():
39
 
40
  embeddings = create_embeddings_load_data()
41
 
 
42
  push_to_chroma(st.session_state['unique_id'], embeddings, final_docs_list)
43
  relavant_docs = similar_docs(job_description, document_count, st.session_state['unique_id'])
 
44
 
45
  st.write(":heavy_minus_sign:" * 30)
46
 
@@ -50,10 +47,11 @@ def main():
50
 
51
  with st.expander('Show me 👀'):
52
  st.info("**Match Score** : " + str(relavant_docs[item][1]))
53
- summary = get_summary(relavant_docs[item][0], hf_client)
54
  st.write("**Summary** : " + summary)
55
 
56
  st.success("Hope I was able to save your time❤️")
57
 
 
58
  if __name__ == '__main__':
59
  main()
 
1
  import streamlit as st
2
  import os
 
3
  from utils import *
4
+ import uuid
5
+
6
+ st.write("Token exists:", bool(os.getenv("HUGGINGFACEHUB_API_TOKEN")))
7
 
8
  if 'unique_id' not in st.session_state:
9
  st.session_state['unique_id'] = ''
10
 
11
+
12
  def main():
13
  st.set_page_config(page_title="Resume Screening Assistance")
14
  st.title("HR - Resume Screening Assistance...💁 ")
 
26
  st.error("ERROR: HUGGINGFACEHUB_API_TOKEN not found. Set it in Hugging Face Space Secrets.")
27
  return
28
 
 
 
 
 
 
 
 
 
29
  with st.spinner('Wait for it...'):
30
  st.session_state['unique_id'] = uuid.uuid4().hex
31
  final_docs_list = create_docs(pdf, st.session_state['unique_id'])
 
34
 
35
  embeddings = create_embeddings_load_data()
36
 
37
+ # --- CHROMADB REPLACEMENT ---
38
  push_to_chroma(st.session_state['unique_id'], embeddings, final_docs_list)
39
  relavant_docs = similar_docs(job_description, document_count, st.session_state['unique_id'])
40
+ # ---------------------------
41
 
42
  st.write(":heavy_minus_sign:" * 30)
43
 
 
47
 
48
  with st.expander('Show me 👀'):
49
  st.info("**Match Score** : " + str(relavant_docs[item][1]))
50
+ summary = get_summary(relavant_docs[item][0])
51
  st.write("**Summary** : " + summary)
52
 
53
  st.success("Hope I was able to save your time❤️")
54
 
55
+
56
  if __name__ == '__main__':
57
  main()