Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ from flask import Flask, render_template,request,flash , json, url_for,g , redir
|
|
| 3 |
import os
|
| 4 |
import json
|
| 5 |
import fitz
|
| 6 |
-
from PIL import Image
|
| 7 |
import cv2
|
| 8 |
import numpy as np
|
| 9 |
import pilecaps_adr
|
|
@@ -221,17 +221,17 @@ def measureproject(result,dataDoc=0,img=0,dxffile=0):
|
|
| 221 |
dbxTeam= tsadropboxretrieval.ADR_Access_DropboxTeam('user')
|
| 222 |
md, res =dbxTeam.files_download(path=dbpdfpath)
|
| 223 |
dataDoc = res.content
|
| 224 |
-
annotatedimg,pdf_document,spreadsheet_url, list1=doors_fasterrcnn.main_run(dataDoc,'single_double.pth',result[0],pdfpath, result[4]) #single_double.pth
|
| 225 |
|
| 226 |
dbPath='/TSA JOBS/ADR Test'+pdfpath+'Measured Plan/'
|
| 227 |
-
pdflink= tsadropboxretrieval.uploadanyFile(doc=pdf_document,path=dbPath,pdfname=
|
| 228 |
print(pdflink)
|
| 229 |
# dpxlinks.append(pdflink)
|
| 230 |
# legendLinks.append(spreadsheet_url)
|
| 231 |
# listofmarkups.append(list1.to_dict())
|
| 232 |
_, buffer = cv2.imencode('.png', annotatedimg)
|
| 233 |
# imgss.append(base64.b64encode(buffer).decode('utf-8'))
|
| 234 |
-
arr=[base64.b64encode(buffer).decode('utf-8') ,pdflink,spreadsheet_url,list1.to_dict()]# , spreadsheetId, spreadsheet_url , list1.to_dict()]
|
| 235 |
|
| 236 |
################################# -2.2- #################################
|
| 237 |
# elif result[5][2].startswith('2.2'): #section value - 2.2 rc slabs
|
|
@@ -469,6 +469,9 @@ def dltmarkupslegend():
|
|
| 469 |
print('deletedrows',deletedrows)
|
| 470 |
if section.startswith('1.0'):
|
| 471 |
newlgnd=google_sheet_Legend.deletefromlegend(deletedrows=deletedrows,SimilarAreaDictionarycopy=SimilarAreaDictionary, section=section,areaPermArr=areaPermArr)
|
|
|
|
|
|
|
|
|
|
| 472 |
else:
|
| 473 |
newlgnd=google_sheet_Legend.deletefromlegend(deletedrows=deletedrows,SimilarAreaDictionarycopy=SimilarAreaDictionary, section=section)
|
| 474 |
try:
|
|
@@ -476,7 +479,7 @@ def dltmarkupslegend():
|
|
| 476 |
newlgnd1=google_sheet_Legend.legendGoogleSheets(SimilarAreaDictionary=newlgnd,path=path,spreadsheetId=spreadsheetId ,pdfpath=pdfpth) #new legend
|
| 477 |
except:
|
| 478 |
print("An exception occurred")
|
| 479 |
-
time.sleep(
|
| 480 |
newlgnd1=google_sheet_Legend.legendGoogleSheets(SimilarAreaDictionary=newlgnd,path=path,spreadsheetId=spreadsheetId,pdfpath=pdfpth)
|
| 481 |
|
| 482 |
return jsonify('donee')
|
|
@@ -670,6 +673,7 @@ def cvtSummarytoXML(jsdata):
|
|
| 670 |
# print(result[1])
|
| 671 |
xmllink=google_sheet_to_xml.create_xml(documentname=result[1],dbPath=path)
|
| 672 |
return jsonify(xmllink)
|
|
|
|
| 673 |
#_________________________________________________________________________________________________________________________
|
| 674 |
#_________________________________________________________________________________________________________________________
|
| 675 |
|
|
|
|
| 3 |
import os
|
| 4 |
import json
|
| 5 |
import fitz
|
| 6 |
+
from PIL import Image
|
| 7 |
import cv2
|
| 8 |
import numpy as np
|
| 9 |
import pilecaps_adr
|
|
|
|
| 221 |
dbxTeam= tsadropboxretrieval.ADR_Access_DropboxTeam('user')
|
| 222 |
md, res =dbxTeam.files_download(path=dbpdfpath)
|
| 223 |
dataDoc = res.content
|
| 224 |
+
annotatedimg,pdf_document,spreadsheet_url, list1 , df_doors=doors_fasterrcnn.main_run(dataDoc,'single_double.pth',result[0],pdfpath, result[4]) #single_double.pth
|
| 225 |
|
| 226 |
dbPath='/TSA JOBS/ADR Test'+pdfpath+'Measured Plan/'
|
| 227 |
+
pdflink= tsadropboxretrieval.uploadanyFile(doc=pdf_document,path=dbPath,pdfname=result[0]) #doc=doc,pdfname=path,pdfpath=pdfpath+'Measured Plan/'
|
| 228 |
print(pdflink)
|
| 229 |
# dpxlinks.append(pdflink)
|
| 230 |
# legendLinks.append(spreadsheet_url)
|
| 231 |
# listofmarkups.append(list1.to_dict())
|
| 232 |
_, buffer = cv2.imencode('.png', annotatedimg)
|
| 233 |
# imgss.append(base64.b64encode(buffer).decode('utf-8'))
|
| 234 |
+
arr=[base64.b64encode(buffer).decode('utf-8') ,pdflink,spreadsheet_url,list1.to_dict(), df_doors.to_dict()]# , spreadsheetId, spreadsheet_url , list1.to_dict()]
|
| 235 |
|
| 236 |
################################# -2.2- #################################
|
| 237 |
# elif result[5][2].startswith('2.2'): #section value - 2.2 rc slabs
|
|
|
|
| 469 |
print('deletedrows',deletedrows)
|
| 470 |
if section.startswith('1.0'):
|
| 471 |
newlgnd=google_sheet_Legend.deletefromlegend(deletedrows=deletedrows,SimilarAreaDictionarycopy=SimilarAreaDictionary, section=section,areaPermArr=areaPermArr)
|
| 472 |
+
elif section.startswith('2.8'):
|
| 473 |
+
newlgnd=google_sheet_Legend.delete3_2(deletedrows,SimilarAreaDictionary)
|
| 474 |
+
print('done wit 2.8 in deleting, didnt append yet ')
|
| 475 |
else:
|
| 476 |
newlgnd=google_sheet_Legend.deletefromlegend(deletedrows=deletedrows,SimilarAreaDictionarycopy=SimilarAreaDictionary, section=section)
|
| 477 |
try:
|
|
|
|
| 479 |
newlgnd1=google_sheet_Legend.legendGoogleSheets(SimilarAreaDictionary=newlgnd,path=path,spreadsheetId=spreadsheetId ,pdfpath=pdfpth) #new legend
|
| 480 |
except:
|
| 481 |
print("An exception occurred")
|
| 482 |
+
time.sleep(20)
|
| 483 |
newlgnd1=google_sheet_Legend.legendGoogleSheets(SimilarAreaDictionary=newlgnd,path=path,spreadsheetId=spreadsheetId,pdfpath=pdfpth)
|
| 484 |
|
| 485 |
return jsonify('donee')
|
|
|
|
| 673 |
# print(result[1])
|
| 674 |
xmllink=google_sheet_to_xml.create_xml(documentname=result[1],dbPath=path)
|
| 675 |
return jsonify(xmllink)
|
| 676 |
+
|
| 677 |
#_________________________________________________________________________________________________________________________
|
| 678 |
#_________________________________________________________________________________________________________________________
|
| 679 |
|