Update app.py
Browse files
app.py
CHANGED
@@ -208,19 +208,10 @@ def query_pdf():
|
|
208 |
|
209 |
# Convert response to string
|
210 |
response_text = str(chat_response.content)
|
211 |
-
print(response_text)
|
212 |
-
# Extract multiple image paths from response
|
213 |
-
image_pattern = r"(static/output_images/[\w\d_]+\.(?:png|jpg|jpeg|gif))"
|
214 |
-
|
215 |
-
extracted_images = re.findall(image_pattern, response_text)
|
216 |
-
|
217 |
-
# Remove image paths from text
|
218 |
-
cleaned_text = re.sub(image_pattern, "", response_text).strip()
|
219 |
|
220 |
# Final response JSON
|
221 |
response = {
|
222 |
-
"text":
|
223 |
-
"images": extracted_images # Store multiple images in a list
|
224 |
}
|
225 |
print(response)
|
226 |
|
|
|
208 |
|
209 |
# Convert response to string
|
210 |
response_text = str(chat_response.content)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
|
212 |
# Final response JSON
|
213 |
response = {
|
214 |
+
"text": response_text # Store multiple images in a list
|
|
|
215 |
}
|
216 |
print(response)
|
217 |
|