Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -137,11 +137,19 @@ def hexRGB(color):
|
|
| 137 |
@app.route('/savebase64Img/',methods=["POST"])
|
| 138 |
def stringToRGB():
|
| 139 |
vv = eval(request.form.get('answers'))
|
| 140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
if 'file' not in request.files:
|
| 142 |
print('error, No file part in the request')
|
| 143 |
-
else:
|
| 144 |
file = request.files['file']
|
|
|
|
| 145 |
arr=measureproject(vv,dataDoc,opencv_img,file)
|
| 146 |
return jsonify(arr)
|
| 147 |
if vv[1]==220:
|
|
@@ -189,6 +197,7 @@ def measureproject(result,dataDoc,img=0,dxffile=0):
|
|
| 189 |
temp_filename = temp_file.name
|
| 190 |
print(temp_filename)
|
| 191 |
doc,outputimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1,hatched_areas=dxf__omar3_2.mainFunctionDrawImgPdf(dataDoc,temp_filename,result[4] , pdfpath,result[0])
|
|
|
|
| 192 |
dbPath='/TSA JOBS/ADR Test'+pdfpath+'Measured Plan/'
|
| 193 |
pdflink= tsadropboxretrieval.uploadanyFile(doc=doc,path=dbPath,pdfname=result[0]) #doc=doc,pdfname=path,pdfpath=pdfpath+'Measured Plan/'
|
| 194 |
|
|
|
|
| 137 |
@app.route('/savebase64Img/',methods=["POST"])
|
| 138 |
def stringToRGB():
|
| 139 |
vv = eval(request.form.get('answers'))
|
| 140 |
+
if vv[5][2].startswith('3.2'):
|
| 141 |
+
print('3.2 section')
|
| 142 |
+
pdfpath,pdflink=tsadropboxretrieval.getPathtoPDF_File(nameofPDF=nameofpdf)
|
| 143 |
+
dbxTeam= tsadropboxretrieval.ADR_Access_DropboxTeam('user')
|
| 144 |
+
md, res =dbxTeam.files_download(path=pdfpath)
|
| 145 |
+
dataDoc = res.content
|
| 146 |
+
else:
|
| 147 |
+
opencv_img,dataDoc = plan2img( str(vv[0]) )
|
| 148 |
if 'file' not in request.files:
|
| 149 |
print('error, No file part in the request')
|
| 150 |
+
else:
|
| 151 |
file = request.files['file']
|
| 152 |
+
print('file done, measuring')
|
| 153 |
arr=measureproject(vv,dataDoc,opencv_img,file)
|
| 154 |
return jsonify(arr)
|
| 155 |
if vv[1]==220:
|
|
|
|
| 197 |
temp_filename = temp_file.name
|
| 198 |
print(temp_filename)
|
| 199 |
doc,outputimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1,hatched_areas=dxf__omar3_2.mainFunctionDrawImgPdf(dataDoc,temp_filename,result[4] , pdfpath,result[0])
|
| 200 |
+
print('done measuring')
|
| 201 |
dbPath='/TSA JOBS/ADR Test'+pdfpath+'Measured Plan/'
|
| 202 |
pdflink= tsadropboxretrieval.uploadanyFile(doc=doc,path=dbPath,pdfname=result[0]) #doc=doc,pdfname=path,pdfpath=pdfpath+'Measured Plan/'
|
| 203 |
|