Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,23 +18,26 @@ def thismain():
|
|
| 18 |
def process():
|
| 19 |
# check_api_key()
|
| 20 |
try:
|
| 21 |
-
|
|
|
|
| 22 |
data = request.get_json() # Correct method to get JSON data
|
| 23 |
print(data)
|
| 24 |
-
|
| 25 |
# Ensure 'pdfpath' is included in the request
|
| 26 |
if 'filePath' not in data:
|
| 27 |
return jsonify({"error": "Missing 'pdfpath' in request data"}), 400
|
| 28 |
-
|
| 29 |
pdfpath = data['filePath']
|
| 30 |
-
|
| 31 |
dbxTeam = tsadropboxretrieval.ADR_Access_DropboxTeam('user')
|
|
|
|
| 32 |
md, res = dbxTeam.files_download(path=pdfpath)
|
| 33 |
pdf_data = res.content
|
|
|
|
| 34 |
|
| 35 |
# Ensure 'pdftotext.texts_from_pdf' is a valid function
|
| 36 |
pdftext = pdftotext.texts_from_pdf(pdf_data)
|
| 37 |
-
|
| 38 |
# Prepare response
|
| 39 |
response_data = {
|
| 40 |
"message": "Data received",
|
|
|
|
| 18 |
def process():
|
| 19 |
# check_api_key()
|
| 20 |
try:
|
| 21 |
+
|
| 22 |
+
print('In process [Try]')
|
| 23 |
data = request.get_json() # Correct method to get JSON data
|
| 24 |
print(data)
|
| 25 |
+
print('0')
|
| 26 |
# Ensure 'pdfpath' is included in the request
|
| 27 |
if 'filePath' not in data:
|
| 28 |
return jsonify({"error": "Missing 'pdfpath' in request data"}), 400
|
| 29 |
+
print('1')
|
| 30 |
pdfpath = data['filePath']
|
| 31 |
+
print('2')
|
| 32 |
dbxTeam = tsadropboxretrieval.ADR_Access_DropboxTeam('user')
|
| 33 |
+
print('3')
|
| 34 |
md, res = dbxTeam.files_download(path=pdfpath)
|
| 35 |
pdf_data = res.content
|
| 36 |
+
print('4')
|
| 37 |
|
| 38 |
# Ensure 'pdftotext.texts_from_pdf' is a valid function
|
| 39 |
pdftext = pdftotext.texts_from_pdf(pdf_data)
|
| 40 |
+
print('5')
|
| 41 |
# Prepare response
|
| 42 |
response_data = {
|
| 43 |
"message": "Data received",
|