Marthee commited on
Commit
4978f2d
·
verified ·
1 Parent(s): 51d4d28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -7
app.py CHANGED
@@ -245,14 +245,23 @@ def getfromdropboxImg(jsdata):
245
  def table():
246
  # 1. Get PDF bytes from Dropbox
247
  tt = eval(request.form.get('answers')) # consider json.loads instead of eval
248
- pdfpath, _ = tsadropboxretrieval.getPathtoPDF_File(nameofPDF=tt[0])
249
- dbx = tsadropboxretrieval.ADR_Access_DropboxTeam('user')
250
- _, res = dbx.files_download(path=pdfpath)
251
- pdf_bytes = res.content
252
-
 
 
 
 
 
 
 
 
 
253
  # 2. Generate in-memory Excel
254
- excel_io = Azure_api.detect_tables(pdf_bytes)
255
- print('type(excel_io) = ', type(excel_io))
256
  # 3. Send it as a downloadable .xlsx
257
  if excel_io is None:
258
  # No tables → return a JSON error (or another response of your choice)
 
245
  def table():
246
  # 1. Get PDF bytes from Dropbox
247
  tt = eval(request.form.get('answers')) # consider json.loads instead of eval
248
+ print("Value of tt = ",tt)
249
+ print("Value of tt[0] = ",tt[0])
250
+ pdflist=[]
251
+ pdfnames=[]
252
+ for i in range(len(tt[0])):
253
+ print("Value of tt[0] = ",tt[0][i])
254
+ pdfpath, _ = tsadropboxretrieval.getPathtoPDF_File(nameofPDF=tt[0][i])
255
+ dbx = tsadropboxretrieval.ADR_Access_DropboxTeam('user')
256
+ _, res = dbx.files_download(path=pdfpath)
257
+ pdf_bytes = res.content
258
+ pdflist.append(pdf_bytes)
259
+ pdfnames.append(pdfpath)
260
+
261
+
262
  # 2. Generate in-memory Excel
263
+ print("pdflist = ",pdflist)
264
+ excel_io = Azure_api.detect_tables(pdflist,pdfnames)
265
  # 3. Send it as a downloadable .xlsx
266
  if excel_io is None:
267
  # No tables → return a JSON error (or another response of your choice)