Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,18 +35,18 @@ def receive_pdf_data():
|
|
| 35 |
global pdf_content, pageNumTextFound
|
| 36 |
|
| 37 |
# Get PDF link and keyword from the request body
|
| 38 |
-
|
| 39 |
keyword = request.form.get('keyword')
|
| 40 |
|
| 41 |
-
if not
|
| 42 |
-
return jsonify({"error": "Both '
|
| 43 |
|
| 44 |
try:
|
| 45 |
# Call the function to process the PDF
|
| 46 |
keyword = json.loads(keyword)
|
| 47 |
|
| 48 |
global pdf_content
|
| 49 |
-
pdf_content, pageNumTextFound,highlight_rect = Find_Hyperlinking_text.annotate_text_from_pdf([
|
| 50 |
|
| 51 |
if pdf_content is None:
|
| 52 |
return jsonify({"error": "No valid PDF content found."}), 404
|
|
|
|
| 35 |
global pdf_content, pageNumTextFound
|
| 36 |
|
| 37 |
# Get PDF link and keyword from the request body
|
| 38 |
+
pdfLink = request.form.get('pdfLink')
|
| 39 |
keyword = request.form.get('keyword')
|
| 40 |
|
| 41 |
+
if not pdfLink or not keyword:
|
| 42 |
+
return jsonify({"error": "Both 'pdfLink' and 'keyword' must be provided."}), 400
|
| 43 |
|
| 44 |
try:
|
| 45 |
# Call the function to process the PDF
|
| 46 |
keyword = json.loads(keyword)
|
| 47 |
|
| 48 |
global pdf_content
|
| 49 |
+
pdf_content, pageNumTextFound,highlight_rect = Find_Hyperlinking_text.annotate_text_from_pdf([pdfLink], keyword)
|
| 50 |
|
| 51 |
if pdf_content is None:
|
| 52 |
return jsonify({"error": "No valid PDF content found."}), 404
|