JaphetHernandez commited on
Commit
37003f2
·
verified ·
1 Parent(s): 1c5ffc3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -6,6 +6,7 @@ from langchain.llms import HuggingFacePipeline
6
  from huggingface_hub import login
7
  from pydantic import BaseModel, model_validator
8
 
 
9
  # Token Secret of Hugging Face
10
  huggingface_token = st.secrets["HUGGINGFACEHUB_API_TOKEN"]
11
  login(huggingface_token)
@@ -50,18 +51,19 @@ if uploaded_file is not None:
50
  if query:
51
  st.write("Query:", query)
52
 
53
- # Crear el prompt para el LLM
54
  prompt = f"""
55
- You are an AI assistant. You will be given a list of job titles and a search query.
56
- Your task is to calculate the cosine similarity score between the query and each job title.
57
- You should then return a sorted list of job titles based on the similarity score, from highest to lowest.
58
- Provide the output in the following format:
59
-
60
- 1. Job Title: [Job Title], Score: [Cosine Similarity Score]
61
- 2. Job Title: [Job Title], Score: [Cosine Similarity Score]
 
62
  ...
 
63
 
64
- Query: {query}
65
  Job Titles: {job_titles}
66
  """
67
 
 
6
  from huggingface_hub import login
7
  from pydantic import BaseModel, model_validator
8
 
9
+
10
  # Token Secret of Hugging Face
11
  huggingface_token = st.secrets["HUGGINGFACEHUB_API_TOKEN"]
12
  login(huggingface_token)
 
51
  if query:
52
  st.write("Query:", query)
53
 
 
54
  prompt = f"""
55
+ You are an AI assistant. You have a list of job titles and a search query.
56
+ Your task is to rank these job titles by their semantic similarity to the given query.
57
+ Please provide the ranking from most relevant to least relevant.
58
+ Do not calculate cosine similarity; instead, focus on understanding the semantic relevance of each job title to the query.
59
+
60
+ Format your response like this:
61
+ 1. [Most Relevant Job Title]
62
+ 2. [Second Most Relevant Job Title]
63
  ...
64
+ N. [Least Relevant Job Title]
65
 
66
+ Query: "{query}"
67
  Job Titles: {job_titles}
68
  """
69