Spaces:
Running
Running
Lauredecaudin
commited on
Commit
•
2ac107e
1
Parent(s):
3b83b5b
Update pages/4-Create your own bot (advanced).py
Browse files
pages/4-Create your own bot (advanced).py
CHANGED
@@ -112,9 +112,17 @@ def extract_text_from_pdf(pdf_file):
|
|
112 |
return text
|
113 |
|
114 |
def generate_answer(question, context):
|
115 |
-
#
|
116 |
-
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
# Streamlit app layout
|
120 |
st.title("Resume-based Q&A Bot")
|
|
|
112 |
return text
|
113 |
|
114 |
def generate_answer(question, context):
|
115 |
+
# Add context to the question
|
116 |
+
context_instruction = (
|
117 |
+
f"Your professional experience is outlined in the following resume. "
|
118 |
+
"Answer the question as if you are the candidate, providing details from the resume where relevant."
|
119 |
+
)
|
120 |
+
|
121 |
+
# Combine the question with the context instruction
|
122 |
+
full_question = f"{context_instruction} Question: {question}"
|
123 |
+
|
124 |
+
# Get the answer using DistilBERT pipeline
|
125 |
+
result = qa_pipeline(question=full_question, context=resume_text)
|
126 |
|
127 |
# Streamlit app layout
|
128 |
st.title("Resume-based Q&A Bot")
|