Spaces:
Sleeping
Sleeping
Update doors_fasterrcnn.py
Browse files- doors_fasterrcnn.py +6 -4
doors_fasterrcnn.py
CHANGED
|
@@ -41,7 +41,7 @@ from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
|
|
| 41 |
from PIL import Image, ImageDraw
|
| 42 |
import torchvision.transforms.functional as F
|
| 43 |
import matplotlib.pyplot as plt
|
| 44 |
-
|
| 45 |
"""# updated for (fullpath, pdf_name)
|
| 46 |
|
| 47 |
|
|
@@ -166,7 +166,7 @@ def add_annotations_to_pdf(image, pdf_name, annotation_s, annotation_d):
|
|
| 166 |
# pdf_document.save(output_pdf_path)
|
| 167 |
# pdf_document.close()
|
| 168 |
|
| 169 |
-
def main_run(pdf_fullpath, weights_path, pdf_name):
|
| 170 |
img_pillow = convert2pillow(pdf_fullpath)
|
| 171 |
new_image = img_pillow.resize((2384, 1684))
|
| 172 |
|
|
@@ -214,8 +214,10 @@ def main_run(pdf_fullpath, weights_path, pdf_name):
|
|
| 214 |
pl=Image.frombytes('RGB', [pix.width,pix.height],pix.samples)
|
| 215 |
img=np.array(pl)
|
| 216 |
annotatedimg = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
|
| 217 |
-
|
| 218 |
-
|
|
|
|
|
|
|
| 219 |
|
| 220 |
# model_path = '/content/drive/MyDrive/combined.pth'
|
| 221 |
# #pdf_name = data
|
|
|
|
| 41 |
from PIL import Image, ImageDraw
|
| 42 |
import torchvision.transforms.functional as F
|
| 43 |
import matplotlib.pyplot as plt
|
| 44 |
+
import google_sheet_Legend
|
| 45 |
"""# updated for (fullpath, pdf_name)
|
| 46 |
|
| 47 |
|
|
|
|
| 166 |
# pdf_document.save(output_pdf_path)
|
| 167 |
# pdf_document.close()
|
| 168 |
|
| 169 |
+
def main_run(pdf_fullpath, weights_path, pdf_name,pdfpath): ####pdf_fullpath here is the data and not the path
|
| 170 |
img_pillow = convert2pillow(pdf_fullpath)
|
| 171 |
new_image = img_pillow.resize((2384, 1684))
|
| 172 |
|
|
|
|
| 214 |
pl=Image.frombytes('RGB', [pix.width,pix.height],pix.samples)
|
| 215 |
img=np.array(pl)
|
| 216 |
annotatedimg = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
|
| 217 |
+
|
| 218 |
+
df_doors = df_doors.fillna(' ')
|
| 219 |
+
gc,spreadsheet_service,spreadsheetId, spreadsheet_url , namepathArr=google_sheet_Legend.legendGoogleSheets(df_doors , pdf_name,pdfpath)
|
| 220 |
+
return annotatedimg, pdf_document , spreadsheet_url
|
| 221 |
|
| 222 |
# model_path = '/content/drive/MyDrive/combined.pth'
|
| 223 |
# #pdf_name = data
|