Marthee commited on
Commit
4dc1809
·
1 Parent(s): e334df8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -38
app.py CHANGED
@@ -1009,55 +1009,57 @@ def saveExcel(Dictionary,plan):
1009
  d=dropbox_upload_file('.',local_file=Dictionary,dropbox_file_path='/savedMeasurements/'+plan+'summaryNamed.csv')
1010
 
1011
 
 
 
 
 
1012
  with gr.Blocks(css="#search {background: orangered}") as mainBlock:
1013
- with gr.Column():
1014
- with gr.Accordion("User Guide "):
1015
- gr.Markdown("Please read this before you use this tool. \n Note : The algorithm is based on detecting shapes from the plan. Some shapes such as tables and Textboxes containing information about the plan may be seen as a shape and inserted into the algorithm as well. To avoid this, clean up the plan before you choose to measure it by erasing them or drawing a white rectangle above them using any external tool. \n Please note that the pdfs inserted in this tab should be pile caps only.\n The tool is divided into two main parts:\n * First Part (until the measure button) \n - You will find three dropdowns. Choose the name of the project you want to measure, along with the project part, and the project section. \n - Then choose whether this project contains levels or not. If you wish to measure all of the plan choose Measure full image. If you wish to measure certain regions of the plan or divide the plan into regions please choose Measure Specific regions. \n - If you choose Measure specific regions, please draw shapes around the desired regions on Bluebeam or any external tool before choosing to measure this plan. \n Also, you should insert the colors in rgb format (Red-Green-Blue) of the levels. \n The output of the first part will be in the unit pixels. To convert the measurements into a metric unit. Please refer to the the second part for detailed information. \n * Second part (Unit Conversion - This occurs once only) \n - Choose one of the shapes of the measured plan (preferably the largest shape) and measure it in Bluebeam. \n - In the first field labeled Real value, please enter the value you obtained from the measurement you made on Bluebeam. \n - In the second field labeled Pixel value, enter the pixel value of the same shape in which you measured that is shown in the output of the first part. \n - The unit in which the conversion will be into. \n This creates a ratio so that the conversion would be as accurate as possible. You can think of this as the scale check logic in Bluebeam. \n Outputs:\n The first output is an image of the plan measured and color sorted. \n The second output is a representation of the Legend exported.\n The column named MC-Template Name is empty for you to enter the MC-T name. \n The column named Area is the area measured of one of the shape.\n The column named Occurences is the number of count of this shape - This is just to make sure every shape was seen correctly and thus summed later correctly.\n The column named Total Area contains the summed areas of each shape \n The column named Unit refers to the unit in which the conversion was made to.")
1016
- with gr.Column():
1017
- project=gr.Dropdown(choices=['BMW job1','BMW job2','Project C'],interactive=True,label='Projects')
1018
- drop=gr.Dropdown(choices=None,interactive=True,label='project parts')
1019
- radio_button = gr.Dropdown(choices=['foundation','external','interior'], value=None, interactive=True,label='sections')
1020
- # with gr.Row():
1021
- in2=gr.Radio(label="Measurement",choices=["Measure Full Image", "Measure Specified Regions"])
1022
- in3=gr.Radio(label="Area or Perimeter",choices=["Area", "Perimeter"])
1023
- with gr.Row():
1024
- in4=gr.ColorPicker(label="color" )
1025
- in5=gr.ColorPicker(label="color" )
1026
- in6=gr.ColorPicker(label="color" )
1027
- in7=gr.ColorPicker(label="color" )
1028
- in8=gr.ColorPicker(label="color" )
1029
- in9=gr.ColorPicker(label="color" )
1030
- in10=gr.ColorPicker(label="color" )
1031
- in11=gr.ColorPicker(label="color" )
1032
- in12=gr.ColorPicker(label="color" )
1033
 
1034
  # clr_btn=gr.Button(value='Clear')
1035
  #######################################################
1036
 
1037
 
1038
 
1039
- with gr.Column():
1040
- img1=gr.Image()
1041
  # img2=gr.Image()
1042
  # df=gr.Dataframe()
1043
 
1044
 
1045
- show_button = gr.Button(value="Measure",elem_id='search')
1046
- with gr.Row():
1047
 
1048
- with gr.Column():
1049
- num1=gr.Number(label='Real value')
1050
- num2=gr.Number(label='Pixel value')
1051
- dp=gr.Dropdown(["m", "cm", "mm"])
1052
- btn = gr.Button("Submit Ratio")
1053
-
1054
- check=gr.Checkbox(label='SaveOutput')
1055
- check1=gr.Checkbox(label='Export to Excel')
1056
- with gr.Column():
1057
- out1=gr.Image(label="Image", type="pil", image_mode="RGBA")
1058
- out2=gr.Dataframe(label='Dictionary', interactive=True) # row_count = (5, "fixed")
1059
-
1060
- buttonSaveDf=gr.Button("Save dataframe")
1061
 
1062
  # getMeasurement(plan,SaveOP) #drop, check
1063
  show_button.click(fn=getMeasurement, inputs=[ drop, check ,check1, dp,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11,in12],outputs=img1)
@@ -1070,4 +1072,3 @@ with gr.Blocks(css="#search {background: orangered}") as mainBlock:
1070
  project.change(fn=update_dropdown, inputs=[project], outputs=drop)
1071
 
1072
  mainBlock.launch(debug=True,enable_queue=True)
1073
-
 
1009
  d=dropbox_upload_file('.',local_file=Dictionary,dropbox_file_path='/savedMeasurements/'+plan+'summaryNamed.csv')
1010
 
1011
 
1012
+
1013
+ # with gr.Column():
1014
+ # with gr.Accordion("User Guide "):
1015
+ # gr.Markdown("Please read this before you use this tool. \n Note : The algorithm is based on detecting shapes from the plan. Some shapes such as tables and Textboxes containing information about the plan may be seen as a shape and inserted into the algorithm as well. To avoid this, clean up the plan before you choose to measure it by erasing them or drawing a white rectangle above them using any external tool. \n Please note that the pdfs inserted in this tab should be pile caps only.\n The tool is divided into two main parts:\n * First Part (until the measure button) \n - You will find three dropdowns. Choose the name of the project you want to measure, along with the project part, and the project section. \n - Then choose whether this project contains levels or not. If you wish to measure all of the plan choose Measure full image. If you wish to measure certain regions of the plan or divide the plan into regions please choose Measure Specific regions. \n - If you choose Measure specific regions, please draw shapes around the desired regions on Bluebeam or any external tool before choosing to measure this plan. \n Also, you should insert the colors in rgb format (Red-Green-Blue) of the levels. \n The output of the first part will be in the unit pixels. To convert the measurements into a metric unit. Please refer to the the second part for detailed information. \n * Second part (Unit Conversion - This occurs once only) \n - Choose one of the shapes of the measured plan (preferably the largest shape) and measure it in Bluebeam. \n - In the first field labeled Real value, please enter the value you obtained from the measurement you made on Bluebeam. \n - In the second field labeled Pixel value, enter the pixel value of the same shape in which you measured that is shown in the output of the first part. \n - The unit in which the conversion will be into. \n This creates a ratio so that the conversion would be as accurate as possible. You can think of this as the scale check logic in Bluebeam. \n Outputs:\n The first output is an image of the plan measured and color sorted. \n The second output is a representation of the Legend exported.\n The column named MC-Template Name is empty for you to enter the MC-T name. \n The column named Area is the area measured of one of the shape.\n The column named Occurences is the number of count of this shape - This is just to make sure every shape was seen correctly and thus summed later correctly.\n The column named Total Area contains the summed areas of each shape \n The column named Unit refers to the unit in which the conversion was made to.")
1016
  with gr.Blocks(css="#search {background: orangered}") as mainBlock:
1017
+ with gr.Row():
1018
+ with gr.Column():
1019
+ project=gr.Dropdown(choices=['BMW job1','BMW job2','Project C'],interactive=True,label='Projects')
1020
+ drop=gr.Dropdown(choices=None,interactive=True,label='project parts')
1021
+ radio_button = gr.Dropdown(choices=['foundation','external','interior'], value=None, interactive=True,label='sections')
1022
+ # with gr.Row():
1023
+ in2=gr.Radio(label="Measurement",choices=["Measure Full Image", "Measure Specified Regions"])
1024
+ in3=gr.Radio(label="Area or Perimeter",choices=["Area", "Perimeter"])
1025
+ with gr.Row():
1026
+ in4=gr.ColorPicker(label="color" )
1027
+ in5=gr.ColorPicker(label="color" )
1028
+ in6=gr.ColorPicker(label="color" )
1029
+ in7=gr.ColorPicker(label="color" )
1030
+ in8=gr.ColorPicker(label="color" )
1031
+ in9=gr.ColorPicker(label="color" )
1032
+ in10=gr.ColorPicker(label="color" )
1033
+ in11=gr.ColorPicker(label="color" )
1034
+ in12=gr.ColorPicker(label="color" )
 
 
1035
 
1036
  # clr_btn=gr.Button(value='Clear')
1037
  #######################################################
1038
 
1039
 
1040
 
1041
+ with gr.Column():
1042
+ img1=gr.Image()
1043
  # img2=gr.Image()
1044
  # df=gr.Dataframe()
1045
 
1046
 
1047
+ show_button = gr.Button(value="Measure",elem_id='search')
1048
+ with gr.Row():
1049
 
1050
+ with gr.Column():
1051
+ num1=gr.Number(label='Real value')
1052
+ num2=gr.Number(label='Pixel value')
1053
+ dp=gr.Dropdown(["m", "cm", "mm"])
1054
+ btn = gr.Button("Submit Ratio")
1055
+
1056
+ check=gr.Checkbox(label='SaveOutput')
1057
+ check1=gr.Checkbox(label='Export to Excel')
1058
+ with gr.Column():
1059
+ out1=gr.Image(label="Image", type="pil", image_mode="RGBA")
1060
+ out2=gr.Dataframe(label='Dictionary', interactive=True) # row_count = (5, "fixed")
1061
+
1062
+ buttonSaveDf=gr.Button("Save dataframe")
1063
 
1064
  # getMeasurement(plan,SaveOP) #drop, check
1065
  show_button.click(fn=getMeasurement, inputs=[ drop, check ,check1, dp,in2,in3,in4,in5,in6,in7,in8,in9,in10,in11,in12],outputs=img1)
 
1072
  project.change(fn=update_dropdown, inputs=[project], outputs=drop)
1073
 
1074
  mainBlock.launch(debug=True,enable_queue=True)