Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -103,7 +103,6 @@ def seperate_image_text_from_pdf(pdf_url):
|
|
103 |
else:
|
104 |
print("Failed to fetch the PDF from the URL.")
|
105 |
except Exception as e:
|
106 |
-
|
107 |
print("An error occurred:", e)
|
108 |
return "Error"
|
109 |
|
@@ -287,9 +286,14 @@ def extract_pdf_text_and_embedding():
|
|
287 |
if(pages_info == "Error"):
|
288 |
return jsonify({"error": "Failed to fetch the PDF from the URL seperate_image_text_from_pdf "}), 500
|
289 |
list.append(4)
|
290 |
-
|
|
|
|
|
|
|
|
|
|
|
291 |
if content == "Error":
|
292 |
-
return jsonify({"error": "An error occurred while processing the PDF"}), 500
|
293 |
list.append(5)
|
294 |
print(content)
|
295 |
return jsonify({"content": content}), 200
|
|
|
103 |
else:
|
104 |
print("Failed to fetch the PDF from the URL.")
|
105 |
except Exception as e:
|
|
|
106 |
print("An error occurred:", e)
|
107 |
return "Error"
|
108 |
|
|
|
286 |
if(pages_info == "Error"):
|
287 |
return jsonify({"error": "Failed to fetch the PDF from the URL seperate_image_text_from_pdf "}), 500
|
288 |
list.append(4)
|
289 |
+
print(pages_info)
|
290 |
+
try:
|
291 |
+
content = pdf_image_text_embedding_and_text_embedding(pages_info)
|
292 |
+
except Exception as e1:
|
293 |
+
print(e1)
|
294 |
+
return jsonify({"error": "An error occurred 1 while processing the PDF"}), 500
|
295 |
if content == "Error":
|
296 |
+
return jsonify({"error": "An error occurred 2 while processing the PDF"}), 500
|
297 |
list.append(5)
|
298 |
print(content)
|
299 |
return jsonify({"content": content}), 200
|