Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
from __future__ import print_function
|
| 2 |
-
from flask import Flask, render_template,request,flash , json, url_for,g , redirect , jsonify , send_file ,make_response
|
| 3 |
import os
|
| 4 |
import json
|
| 5 |
import fitz
|
|
@@ -35,6 +35,7 @@ from threading import Thread
|
|
| 35 |
import mainDBAlaa
|
| 36 |
import datetime
|
| 37 |
import doors_fasterrcnn
|
|
|
|
| 38 |
|
| 39 |
import ezdxf
|
| 40 |
app = Flask(__name__)
|
|
@@ -139,7 +140,7 @@ def hexRGB(color):
|
|
| 139 |
def stringToRGB():
|
| 140 |
vv = eval(request.form.get('answers'))
|
| 141 |
|
| 142 |
-
if vv[5][2].startswith('3.2'):
|
| 143 |
print('3.2 section')
|
| 144 |
pdfpath,pdflink=tsadropboxretrieval.getPathtoPDF_File(nameofPDF=vv[0])
|
| 145 |
dbxTeam= tsadropboxretrieval.ADR_Access_DropboxTeam('user')
|
|
@@ -209,6 +210,21 @@ def measureproject(result,dataDoc=0,img=0,dxffile=0):
|
|
| 209 |
_, buffer = cv2.imencode('.png', outputimg)
|
| 210 |
arr=[ base64.b64encode(buffer).decode('utf-8'),SimilarAreaDictionary.to_dict(), spreadsheet_url,spreadsheetId,[],list1.to_dict(),pdflink,hatched_areas,namepathArr]# , spreadsheetId, spreadsheet_url , list1.to_dict()]
|
| 211 |
################################# -2.8- #################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
elif result[5][2].startswith('2.8'): #section value - 2.8 floor finishes
|
| 213 |
#vv[0] array of pdf names
|
| 214 |
imgss=[]
|
|
@@ -421,6 +437,7 @@ def getnewlegend():
|
|
| 421 |
pdfpth=''
|
| 422 |
alljson = request.get_json()
|
| 423 |
list1=alljson.get('dict1')
|
|
|
|
| 424 |
# list1 = request.args.get('dict1')
|
| 425 |
path=alljson.get('path')
|
| 426 |
# path = request.args.get('path')
|
|
@@ -434,7 +451,8 @@ def getnewlegend():
|
|
| 434 |
pdfpth+='/' +word
|
| 435 |
pdfpth+='/'
|
| 436 |
dbPath='/TSA JOBS/ADR Test'+pdfpth+'Measured Plan/'
|
| 437 |
-
|
|
|
|
| 438 |
arr1=[deletedrows1.to_dict()]
|
| 439 |
print('arr,',arr1)
|
| 440 |
return jsonify(arr1)
|
|
@@ -467,7 +485,7 @@ def dltmarkupslegend():
|
|
| 467 |
# myDict=eval(deletedrows)
|
| 468 |
deletedrows=pd.DataFrame(deletedrows)
|
| 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)
|
|
|
|
| 1 |
from __future__ import print_function
|
| 2 |
+
from flask import Flask, render_template,request,flash , json, url_for,g , redirect , jsonify , send_file ,make_response
|
| 3 |
import os
|
| 4 |
import json
|
| 5 |
import fitz
|
|
|
|
| 35 |
import mainDBAlaa
|
| 36 |
import datetime
|
| 37 |
import doors_fasterrcnn
|
| 38 |
+
import deploying_3_3
|
| 39 |
|
| 40 |
import ezdxf
|
| 41 |
app = Flask(__name__)
|
|
|
|
| 140 |
def stringToRGB():
|
| 141 |
vv = eval(request.form.get('answers'))
|
| 142 |
|
| 143 |
+
if ( vv[5][2].startswith('3.2') or vv[5][2].startswith('3.3') ) :
|
| 144 |
print('3.2 section')
|
| 145 |
pdfpath,pdflink=tsadropboxretrieval.getPathtoPDF_File(nameofPDF=vv[0])
|
| 146 |
dbxTeam= tsadropboxretrieval.ADR_Access_DropboxTeam('user')
|
|
|
|
| 210 |
_, buffer = cv2.imencode('.png', outputimg)
|
| 211 |
arr=[ base64.b64encode(buffer).decode('utf-8'),SimilarAreaDictionary.to_dict(), spreadsheet_url,spreadsheetId,[],list1.to_dict(),pdflink,hatched_areas,namepathArr]# , spreadsheetId, spreadsheet_url , list1.to_dict()]
|
| 212 |
################################# -2.8- #################################
|
| 213 |
+
elif result[5][2].startswith('3.3'): #section value - 3.2 floor finishes
|
| 214 |
+
print('IN HEREEEE 3.3')
|
| 215 |
+
dxfpath=dxffile.read()
|
| 216 |
+
with tempfile.NamedTemporaryFile(suffix='.dxf', delete=False) as temp_file:
|
| 217 |
+
temp_file.write(dxfpath)
|
| 218 |
+
temp_filename = temp_file.name
|
| 219 |
+
print(temp_filename)
|
| 220 |
+
doc,outputimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1,hatched_areas=deploying_3_3.mainFunctionDrawImgPdf(dataDoc,temp_filename,result[4] , pdfpath,result[0])
|
| 221 |
+
dbPath='/TSA JOBS/ADR Test'+pdfpath+'Measured Plan/'
|
| 222 |
+
print(dbPath,result[0])
|
| 223 |
+
pdflink= tsadropboxretrieval.uploadanyFile(doc=doc,path=dbPath,pdfname=result[0]) #doc=doc,pdfname=path,pdfpath=pdfpath+'Measured Plan/'
|
| 224 |
+
|
| 225 |
+
_, buffer = cv2.imencode('.png', outputimg)
|
| 226 |
+
arr=[ base64.b64encode(buffer).decode('utf-8'),SimilarAreaDictionary.to_dict(), spreadsheet_url,spreadsheetId,[],list1.to_dict(),pdflink]#,hatched_areas,namepathArr]# , spreadsheetId, spreadsheet_url , list1.to_dict()]
|
| 227 |
+
################################# -2.8- #################################
|
| 228 |
elif result[5][2].startswith('2.8'): #section value - 2.8 floor finishes
|
| 229 |
#vv[0] array of pdf names
|
| 230 |
imgss=[]
|
|
|
|
| 437 |
pdfpth=''
|
| 438 |
alljson = request.get_json()
|
| 439 |
list1=alljson.get('dict1')
|
| 440 |
+
print('list1',list1)
|
| 441 |
# list1 = request.args.get('dict1')
|
| 442 |
path=alljson.get('path')
|
| 443 |
# path = request.args.get('path')
|
|
|
|
| 451 |
pdfpth+='/' +word
|
| 452 |
pdfpth+='/'
|
| 453 |
dbPath='/TSA JOBS/ADR Test'+pdfpth+'Measured Plan/'
|
| 454 |
+
print(pdfpth)
|
| 455 |
+
deletedrows1=google_sheet_Legend.deletemarkups(list1=list1,dbPath=dbPath,path=path)
|
| 456 |
arr1=[deletedrows1.to_dict()]
|
| 457 |
print('arr,',arr1)
|
| 458 |
return jsonify(arr1)
|
|
|
|
| 485 |
# myDict=eval(deletedrows)
|
| 486 |
deletedrows=pd.DataFrame(deletedrows)
|
| 487 |
print('deletedrows',deletedrows)
|
| 488 |
+
if section.startswith('1.0') or section.startswith('3.2'):
|
| 489 |
newlgnd=google_sheet_Legend.deletefromlegend(deletedrows=deletedrows,SimilarAreaDictionarycopy=SimilarAreaDictionary, section=section,areaPermArr=areaPermArr)
|
| 490 |
elif section.startswith('2.8'):
|
| 491 |
newlgnd=google_sheet_Legend.delete3_2(deletedrows,SimilarAreaDictionary)
|