Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -300,19 +300,23 @@ def stringToRGB():
|
|
| 300 |
if vv[5][2].startswith('2.8') or vv[5][2].startswith('2.6') or vv[5][2].startswith('2.1'):
|
| 301 |
print(f"el mawgood fe vv[0]: {vv[0]}")
|
| 302 |
arr_s = []
|
|
|
|
|
|
|
| 303 |
for v in vv[0]:
|
| 304 |
pdfpath,pdflink=tsadropboxretrieval.getPathtoPDF_File(nameofPDF= str(v))
|
| 305 |
dbxTeam= tsadropboxretrieval.ADR_Access_DropboxTeam('user')
|
| 306 |
md, res =dbxTeam.files_download(path=pdfpath)
|
| 307 |
dataDoc = res.content
|
|
|
|
| 308 |
doc = fitz.open("pdf",dataDoc)
|
| 309 |
page=doc[0]
|
| 310 |
if page.rotation!=0:
|
| 311 |
page.set_rotation(0)
|
| 312 |
pix = page.get_pixmap(dpi=300) # render page to an image
|
| 313 |
pl=Image.frombytes('RGB', [pix.width,pix.height],pix.samples)
|
| 314 |
-
|
| 315 |
-
|
|
|
|
| 316 |
print(f"el mawgood fe arrays: {arr_s}")
|
| 317 |
#pdfpath,pdflink=tsadropboxretrieval.getPathtoPDF_File(nameofPDF= str(vv[0]))
|
| 318 |
|
|
@@ -327,7 +331,7 @@ def stringToRGB():
|
|
| 327 |
#pix = page.get_pixmap(dpi=300) # render page to an image
|
| 328 |
#pl=Image.frombytes('RGB', [pix.width,pix.height],pix.samples)
|
| 329 |
#arr=measureproject(vv,dataDoc,pl)
|
| 330 |
-
return jsonify(
|
| 331 |
|
| 332 |
@app.route('/2.1Trial/',methods=["POST"])
|
| 333 |
def measure2_1():
|
|
|
|
| 300 |
if vv[5][2].startswith('2.8') or vv[5][2].startswith('2.6') or vv[5][2].startswith('2.1'):
|
| 301 |
print(f"el mawgood fe vv[0]: {vv[0]}")
|
| 302 |
arr_s = []
|
| 303 |
+
dataDocs = []
|
| 304 |
+
pls = []
|
| 305 |
for v in vv[0]:
|
| 306 |
pdfpath,pdflink=tsadropboxretrieval.getPathtoPDF_File(nameofPDF= str(v))
|
| 307 |
dbxTeam= tsadropboxretrieval.ADR_Access_DropboxTeam('user')
|
| 308 |
md, res =dbxTeam.files_download(path=pdfpath)
|
| 309 |
dataDoc = res.content
|
| 310 |
+
dataDocs.append(dataDoc)
|
| 311 |
doc = fitz.open("pdf",dataDoc)
|
| 312 |
page=doc[0]
|
| 313 |
if page.rotation!=0:
|
| 314 |
page.set_rotation(0)
|
| 315 |
pix = page.get_pixmap(dpi=300) # render page to an image
|
| 316 |
pl=Image.frombytes('RGB', [pix.width,pix.height],pix.samples)
|
| 317 |
+
pls.append(pl)
|
| 318 |
+
arr=measureproject(vv,dataDocs,pls)
|
| 319 |
+
#arr_s.append(arr)
|
| 320 |
print(f"el mawgood fe arrays: {arr_s}")
|
| 321 |
#pdfpath,pdflink=tsadropboxretrieval.getPathtoPDF_File(nameofPDF= str(vv[0]))
|
| 322 |
|
|
|
|
| 331 |
#pix = page.get_pixmap(dpi=300) # render page to an image
|
| 332 |
#pl=Image.frombytes('RGB', [pix.width,pix.height],pix.samples)
|
| 333 |
#arr=measureproject(vv,dataDoc,pl)
|
| 334 |
+
return jsonify(arr)
|
| 335 |
|
| 336 |
@app.route('/2.1Trial/',methods=["POST"])
|
| 337 |
def measure2_1():
|