Marthee commited on
Commit
6cb2c7e
·
1 Parent(s): 305fbeb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -941,7 +941,7 @@ def getdropdownValues(gc,spreadsheet_service,spreadsheetid):
941
 
942
  return dropdownValues
943
 
944
- def createGoogleSheet(LegendName):
945
  # authorize uing json file
946
  # SimilarAreaDictionary.drop(['Rounded', 'Width','Height','R','G','B'], axis=1, inplace=True)
947
  SCOPES = [
@@ -957,7 +957,7 @@ def createGoogleSheet(LegendName):
957
  # LegendName=getTitle(path)
958
  spreadsheet_details = {
959
  'properties': {
960
- 'title': LegendName
961
  }
962
  }
963
  sheet = spreadsheet_service.spreadsheets().create(body=spreadsheet_details,
@@ -1231,7 +1231,8 @@ def saveExcel(Dictionary,plan):
1231
  # with gr.Accordion("User Guide "):
1232
  # 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, please 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.")
1233
  with gr.Blocks(css="#search {background: orangered}") as mainBlock:
1234
-
 
1235
 
1236
  with gr.Row():
1237
  # with gr.Column():
@@ -1286,8 +1287,7 @@ with gr.Blocks(css="#search {background: orangered}") as mainBlock:
1286
  out1=gr.Image(label="Image", type="pil", image_mode="RGBA")
1287
  out2=gr.Dataframe(label='Dictionary', interactive=True) # row_count = (5, "fixed")
1288
  # out3=gr.HTML( elem_id="coords", visible=True)
1289
- spreadsheetId,spreadsheet_service,gc=createGoogleSheet('ay haga')
1290
- spreadsheet_url = "https://docs.google.com/spreadsheets/d/%s" % spreadsheetId
1291
  out3=gr.HTML( """Click <a href=%s> on this Google Sheet </a> to continue to the Legend.""" %spreadsheet_url)
1292
 
1293
  buttonSaveDf=gr.Button("Save dataframe")
 
941
 
942
  return dropdownValues
943
 
944
+ def createGoogleSheet():
945
  # authorize uing json file
946
  # SimilarAreaDictionary.drop(['Rounded', 'Width','Height','R','G','B'], axis=1, inplace=True)
947
  SCOPES = [
 
957
  # LegendName=getTitle(path)
958
  spreadsheet_details = {
959
  'properties': {
960
+ 'title': 'aa'
961
  }
962
  }
963
  sheet = spreadsheet_service.spreadsheets().create(body=spreadsheet_details,
 
1231
  # with gr.Accordion("User Guide "):
1232
  # 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, please 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.")
1233
  with gr.Blocks(css="#search {background: orangered}") as mainBlock:
1234
+ spreadsheetId,spreadsheet_service,gc=createGoogleSheet()
1235
+ spreadsheet_url = "https://docs.google.com/spreadsheets/d/%s" % spreadsheetId
1236
 
1237
  with gr.Row():
1238
  # with gr.Column():
 
1287
  out1=gr.Image(label="Image", type="pil", image_mode="RGBA")
1288
  out2=gr.Dataframe(label='Dictionary', interactive=True) # row_count = (5, "fixed")
1289
  # out3=gr.HTML( elem_id="coords", visible=True)
1290
+
 
1291
  out3=gr.HTML( """Click <a href=%s> on this Google Sheet </a> to continue to the Legend.""" %spreadsheet_url)
1292
 
1293
  buttonSaveDf=gr.Button("Save dataframe")