Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -271,8 +271,11 @@ def get_video_embedding_route():
|
|
271 |
@cache.cached(timeout=300)
|
272 |
@app.route('/extract_pdf_text_and_embedding', methods=['POST'])
|
273 |
def extract_pdf_text_and_embedding():
|
|
|
274 |
try:
|
|
|
275 |
pdf_url = request.json.get("pdfUrl")
|
|
|
276 |
print(1)
|
277 |
pages_info = "Error"
|
278 |
try :
|
@@ -280,17 +283,20 @@ def extract_pdf_text_and_embedding():
|
|
280 |
except Exception as e:
|
281 |
print(e)
|
282 |
return jsonify({"error": "Failed to fetch the PDF from the URL"}), 500
|
|
|
283 |
if(pages_info == "Error"):
|
284 |
return jsonify({"error": "Failed to fetch the PDF from the URL seperate_image_text_from_pdf "}), 500
|
|
|
285 |
content = pdf_image_text_embedding_and_text_embedding(pages_info)
|
286 |
if content == "Error":
|
287 |
return jsonify({"error": "An error occurred while processing the PDF"}), 500
|
|
|
288 |
print(content)
|
289 |
return jsonify({"content": content}), 200
|
290 |
|
291 |
except Exception as e:
|
292 |
print(e)
|
293 |
-
return jsonify({"error": str(
|
294 |
|
295 |
# Route to get text description embeddings
|
296 |
@cache.cached(timeout=300)
|
|
|
271 |
@cache.cached(timeout=300)
|
272 |
@app.route('/extract_pdf_text_and_embedding', methods=['POST'])
|
273 |
def extract_pdf_text_and_embedding():
|
274 |
+
list = []
|
275 |
try:
|
276 |
+
list.append(1)
|
277 |
pdf_url = request.json.get("pdfUrl")
|
278 |
+
list.append(2)
|
279 |
print(1)
|
280 |
pages_info = "Error"
|
281 |
try :
|
|
|
283 |
except Exception as e:
|
284 |
print(e)
|
285 |
return jsonify({"error": "Failed to fetch the PDF from the URL"}), 500
|
286 |
+
list.append(3)
|
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 |
content = pdf_image_text_embedding_and_text_embedding(pages_info)
|
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
|
296 |
|
297 |
except Exception as e:
|
298 |
print(e)
|
299 |
+
return jsonify({"error": str(list)}), 500
|
300 |
|
301 |
# Route to get text description embeddings
|
302 |
@cache.cached(timeout=300)
|