InkeyDevelopment commited on
Commit
d5f2ab8
·
verified ·
1 Parent(s): a7a9cb8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -162,15 +162,14 @@ def query_pdf():
162
  """
163
  ### YOU ARE AN EXELSYS EASYHR GUIDE ASSISTANT:
164
  ### INSTRUCTIONS:
165
- - Identify the most relevant topic based on the user query.
166
- - Provide step-by-step guidance for that topic only.
167
- - Base your response **only** on the selected topic's content.
168
- - Do not use content from other topics.
169
- - If no relevant topic is found, respond with: "Not found."
170
  - If the user greets you (e.g., "Hello", "Hi", "Good morning"), respond politely but keep it brief.
171
- - If the query is unrelated to Exelsys easyHR, respond with: "I'm here to assist with Exelsys easyHR queries only."
172
- - Format the response like this:
173
- <p>Response text here...</p> \n <a>static/output_images/page_67_img_2.png</a>\n <a>static/output_images/page_45_img_1.jpg</a>
174
 
175
  ### USER QUERY:
176
  {query}
@@ -188,9 +187,10 @@ def query_pdf():
188
 
189
  # Convert response to string
190
  response_text = str(chat_response.content)
191
-
192
  # Extract multiple image paths from response
193
- image_pattern = r"static/output_images/[\w\d_]+\.png"
 
194
  extracted_images = re.findall(image_pattern, response_text)
195
 
196
  # Remove image paths from text
@@ -201,11 +201,12 @@ def query_pdf():
201
  "text": cleaned_text,
202
  "images": extracted_images # Store multiple images in a list
203
  }
204
- print(response)
205
 
206
  return jsonify(response)
207
 
208
 
 
209
  if __name__ == "__main__":
210
  app.run(debug=True)
211
 
 
162
  """
163
  ### YOU ARE AN EXELSYS EASYHR GUIDE ASSISTANT:
164
  ### INSTRUCTIONS:
165
+ ### YOU ARE AN EXELSYS EASYHR GUIDE ASSISTANT:
166
+ ### INSTRUCTIONS:
167
+ - Your job is to provide step-by-step guidance for the following user query.
168
+ - Base your response **only** on the retrieved context from the PDF.
169
+ - If no relevant information is found, simply respond with: "Not found."
170
  - If the user greets you (e.g., "Hello", "Hi", "Good morning"), respond politely but keep it brief.
171
+ - If the query is unrelated to Exelsys easyHR, respond with: "I'm here to assist with Exelsys easyHR queries only."
172
+ - Put images path after response text.
 
173
 
174
  ### USER QUERY:
175
  {query}
 
187
 
188
  # Convert response to string
189
  response_text = str(chat_response.content)
190
+ print(response_text)
191
  # Extract multiple image paths from response
192
+ image_pattern = r"(static/output_images/[\w\d_]+\.(?:png|jpg|jpeg|gif))"
193
+
194
  extracted_images = re.findall(image_pattern, response_text)
195
 
196
  # Remove image paths from text
 
201
  "text": cleaned_text,
202
  "images": extracted_images # Store multiple images in a list
203
  }
204
+
205
 
206
  return jsonify(response)
207
 
208
 
209
+
210
  if __name__ == "__main__":
211
  app.run(debug=True)
212