Update app.py
Browse files
app.py
CHANGED
|
@@ -27,12 +27,12 @@ from PreprocessingFoundation import rmv_text,rmv_dashedLines
|
|
| 27 |
#os.remove('dropbox_plans/Trees.pdf')
|
| 28 |
|
| 29 |
|
| 30 |
-
def pushToDropbox(plan1,area,df
|
| 31 |
plan=Path(os.path.split(plan1)[1]).stem
|
| 32 |
# p=dropbox_upload_file('.',local_file=perim,dropbox_file_path='/savedMeasurements/'+plan+'perim.png')
|
| 33 |
a=dropbox_upload_file('.',local_file=area,dropbox_file_path='/savedMeasurements/'+plan+'area.png')
|
| 34 |
-
if df !=None:
|
| 35 |
-
|
| 36 |
#print(f)
|
| 37 |
|
| 38 |
def auth(username,password):
|
|
@@ -982,8 +982,8 @@ def getMeasurement(plan,SaveOP, dp,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11,num
|
|
| 982 |
else:
|
| 983 |
area=PickColorContours(dp,img,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11)
|
| 984 |
area = cv2.cvtColor(area, cv2.COLOR_RGB2BGR)
|
| 985 |
-
if SaveOP:
|
| 986 |
-
|
| 987 |
return area
|
| 988 |
# else:
|
| 989 |
# areaPerimeterImg,df=PickColorContours(dp,img,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11,num1,num2)
|
|
@@ -1019,8 +1019,6 @@ with gr.Blocks() as mainBlock:
|
|
| 1019 |
drop=gr.Dropdown(choices=None,interactive=True,label='project parts')
|
| 1020 |
radio_button = gr.Dropdown(choices=['foundation','external','interior'], value=None, interactive=True,label='sections')
|
| 1021 |
|
| 1022 |
-
check=gr.Checkbox(label='SaveOutput')
|
| 1023 |
-
show_button = gr.Button(value="Measure",elem_id='search')
|
| 1024 |
# clr_btn=gr.Button(value='Clear')
|
| 1025 |
with gr.Column():
|
| 1026 |
img1=gr.Image()
|
|
@@ -1046,12 +1044,13 @@ with gr.Blocks() as mainBlock:
|
|
| 1046 |
in10=gr.ColorPicker(label="color" )
|
| 1047 |
in11=gr.ColorPicker(label="color" )
|
| 1048 |
|
| 1049 |
-
with gr.Column():
|
| 1050 |
-
|
| 1051 |
#gr.Dataframe(label='Dictionary' ), # row_count = (5, "fixed")
|
| 1052 |
# ]
|
| 1053 |
# btn1 = gr.Button("Submit")
|
| 1054 |
-
|
|
|
|
| 1055 |
with gr.Row():
|
| 1056 |
|
| 1057 |
with gr.Column():
|
|
@@ -1064,6 +1063,7 @@ with gr.Blocks() as mainBlock:
|
|
| 1064 |
gr.Image(label="Image", type="pil", image_mode="RGBA"),
|
| 1065 |
gr.Dataframe(label='Dictionary' ), # row_count = (5, "fixed")
|
| 1066 |
]
|
|
|
|
| 1067 |
# getMeasurement(plan,SaveOP) #drop, check
|
| 1068 |
show_button.click(fn=getMeasurement, inputs=[ drop, check , dp,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11],outputs=img1)
|
| 1069 |
# clr_btn.click(fn=clear,outputs=[project,radio_button,check,drop])
|
|
|
|
| 27 |
#os.remove('dropbox_plans/Trees.pdf')
|
| 28 |
|
| 29 |
|
| 30 |
+
def pushToDropbox(plan1,area,df):
|
| 31 |
plan=Path(os.path.split(plan1)[1]).stem
|
| 32 |
# p=dropbox_upload_file('.',local_file=perim,dropbox_file_path='/savedMeasurements/'+plan+'perim.png')
|
| 33 |
a=dropbox_upload_file('.',local_file=area,dropbox_file_path='/savedMeasurements/'+plan+'area.png')
|
| 34 |
+
# if df !=None:
|
| 35 |
+
d=dropbox_upload_file('.',local_file=df,dropbox_file_path='/savedMeasurements/'+plan+'summary.csv')
|
| 36 |
#print(f)
|
| 37 |
|
| 38 |
def auth(username,password):
|
|
|
|
| 982 |
else:
|
| 983 |
area=PickColorContours(dp,img,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11)
|
| 984 |
area = cv2.cvtColor(area, cv2.COLOR_RGB2BGR)
|
| 985 |
+
# if SaveOP:
|
| 986 |
+
# pushToDropbox(plan, area)
|
| 987 |
return area
|
| 988 |
# else:
|
| 989 |
# areaPerimeterImg,df=PickColorContours(dp,img,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11,num1,num2)
|
|
|
|
| 1019 |
drop=gr.Dropdown(choices=None,interactive=True,label='project parts')
|
| 1020 |
radio_button = gr.Dropdown(choices=['foundation','external','interior'], value=None, interactive=True,label='sections')
|
| 1021 |
|
|
|
|
|
|
|
| 1022 |
# clr_btn=gr.Button(value='Clear')
|
| 1023 |
with gr.Column():
|
| 1024 |
img1=gr.Image()
|
|
|
|
| 1044 |
in10=gr.ColorPicker(label="color" )
|
| 1045 |
in11=gr.ColorPicker(label="color" )
|
| 1046 |
|
| 1047 |
+
# with gr.Column():
|
| 1048 |
+
# out1 = gr.Image(label="Image", type="pil", image_mode="RGBA")
|
| 1049 |
#gr.Dataframe(label='Dictionary' ), # row_count = (5, "fixed")
|
| 1050 |
# ]
|
| 1051 |
# btn1 = gr.Button("Submit")
|
| 1052 |
+
|
| 1053 |
+
show_button = gr.Button(value="Measure",elem_id='search')
|
| 1054 |
with gr.Row():
|
| 1055 |
|
| 1056 |
with gr.Column():
|
|
|
|
| 1063 |
gr.Image(label="Image", type="pil", image_mode="RGBA"),
|
| 1064 |
gr.Dataframe(label='Dictionary' ), # row_count = (5, "fixed")
|
| 1065 |
]
|
| 1066 |
+
check=gr.Checkbox(label='SaveOutput')
|
| 1067 |
# getMeasurement(plan,SaveOP) #drop, check
|
| 1068 |
show_button.click(fn=getMeasurement, inputs=[ drop, check , dp,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11],outputs=img1)
|
| 1069 |
# clr_btn.click(fn=clear,outputs=[project,radio_button,check,drop])
|