Spaces:
Sleeping
Sleeping
Update app.py
Browse files270 unmodified lines2712722732742752762772781 unmodified line280281282283284285286287288289290291292293294295296270 unmodified lines@cache.cached(timeout=300)@app.route('/extract_pdf_text_and_embedding', methods=['POST'])def extract_pdf_text_and_embedding():try:pdf_url = request.json.get("pdfUrl")print(1)pages_info = "Error"try :1 unmodified lineexcept Exception as e:print(e)return jsonify({"error": "Failed to fetch the PDF from the URL"}), 500if(pages_info == "Error"):return jsonify({"error": "Failed to fetch the PDF from the URL seperate_image_text_from_pdf "}), 500content = pdf_image_text_embedding_and_text_embedding(pages_info)if content == "Error":return jsonify({"error": "An error occurred while processing the PDF"}), 500print(content)return jsonify({"content": content}), 200except Exception as e:print(e)return jsonify({"error": str(e)}), 500# Route to get text description embeddings@cache.cached(timeout=300)270 unmodified lines2712722732742752762772782792802811 unmodified line283284285286287288289290291292293294295296297298299300301302270 unmodified lines@cache.cached(timeout=300)@app.route('/extract_pdf_text_and_embedding', methods=['POST'])def extract_pdf_text_and_embedding():list = []try:list.append(1)pdf_url = request.json.get("pdfUrl")list.append(2)print(1)pages_info = "Error"try :1 unmodified lineexcept Exception as e:print(e)return jsonify({"error": "Failed to fetch the PDF from the URL"}), 500list.append(3)if(pages_info == "Error"):return jsonify({"error": "Failed to fetch the PDF from the URL seperate_image_text_from_pdf "}), 500list.append(4)content = pdf_image_text_embedding_and_text_embedding(pages_info)if content == "Error":return jsonify({"error": "An error occurred while processing the PDF"}), 500list.append(5)print(content)return jsonify({"content": content}), 200except Exception as e:print(e)return jsonify({"error": str(list)}), 500# Route to get text description embeddings@cache.cached(timeout=300)
app.py+7-1