Spaces:
Paused
Paused
Tao Wu
commited on
Commit
·
ed7bb2a
1
Parent(s):
5f0b936
add explanation
Browse files- app/app.py +5 -13
app/app.py
CHANGED
@@ -39,9 +39,6 @@ def retrieve_documents(occupation,skills):
|
|
39 |
partial_compare_docs = functools.partial(compare_docs_with_context, df_course=df_course, target_occupation_name=target_occupation_name, target_occupation_dsp=target_occupation_dsp,skill_gap = skill_query)
|
40 |
sorted_docs = sorted(docs, key=functools.cmp_to_key(partial_compare_docs), reverse=True)
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
|
46 |
batch_prompts = []
|
47 |
for doc in sorted_docs[:5]:
|
@@ -53,22 +50,17 @@ def retrieve_documents(occupation,skills):
|
|
53 |
|
54 |
# Evaluate the current batch of prompts
|
55 |
batch_output = generate_exp(batch_prompts)
|
|
|
|
|
56 |
for i in range(5):
|
57 |
doc = sorted_docs[i]
|
58 |
doc_name = doc.metadata.get('name', 'Unnamed Document')
|
59 |
doc_url = doc.metadata.get('url', '#')
|
60 |
doc_skill = doc.metadata.get('skills', '')
|
61 |
output.append(f"<a href='{doc_url}' target='_blank'>{doc_name}</a>")
|
62 |
-
output.append(f"<b>
|
63 |
-
|
64 |
-
|
65 |
-
for doc in sorted_docs[:5]:
|
66 |
-
doc_name = doc.metadata.get('name', 'Unnamed Document')
|
67 |
-
doc_url = doc.metadata.get('url', '#')
|
68 |
-
output.append(f"<a href='{doc_url}' target='_blank'>{doc_name}</a>")
|
69 |
-
input_text = f"target occupation: {target_occupation_query}\n courses: name: {doc_name['course_name']}, learning objectives: {doc_name['skills']}"
|
70 |
-
prompt = generate_prompt_exp(input_text)
|
71 |
-
batch_prompts.append(prompt)
|
72 |
output.append(f"<br>")
|
73 |
return "<br>".join(output)
|
74 |
|
|
|
39 |
partial_compare_docs = functools.partial(compare_docs_with_context, df_course=df_course, target_occupation_name=target_occupation_name, target_occupation_dsp=target_occupation_dsp,skill_gap = skill_query)
|
40 |
sorted_docs = sorted(docs, key=functools.cmp_to_key(partial_compare_docs), reverse=True)
|
41 |
|
|
|
|
|
|
|
42 |
|
43 |
batch_prompts = []
|
44 |
for doc in sorted_docs[:5]:
|
|
|
50 |
|
51 |
# Evaluate the current batch of prompts
|
52 |
batch_output = generate_exp(batch_prompts)
|
53 |
+
output.append(f"<b>Qualifikationslücke:</b> {skill_query}")
|
54 |
+
output.append(f"<b>Empfohlene Kurse:</b>")
|
55 |
for i in range(5):
|
56 |
doc = sorted_docs[i]
|
57 |
doc_name = doc.metadata.get('name', 'Unnamed Document')
|
58 |
doc_url = doc.metadata.get('url', '#')
|
59 |
doc_skill = doc.metadata.get('skills', '')
|
60 |
output.append(f"<a href='{doc_url}' target='_blank'>{doc_name}</a>")
|
61 |
+
output.append(f"<b>Empfehlungsgrund:</b> {batch_output[i]}")
|
62 |
+
|
63 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
output.append(f"<br>")
|
65 |
return "<br>".join(output)
|
66 |
|