Update app.py
Browse files
app.py
CHANGED
|
@@ -38,22 +38,22 @@ def auth(username,password):
|
|
| 38 |
if username=="alaa" and password=="1234":
|
| 39 |
return True
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
|
| 47 |
-
|
| 48 |
-
#
|
| 49 |
-
#
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
#
|
| 56 |
-
|
| 57 |
|
| 58 |
# path='/content/drive/MyDrive/Colab Notebooks/Pile caps plans/13886-CRH-B3-FN-DR-S-31001 - Copy.pdf'
|
| 59 |
|
|
|
|
| 38 |
if username=="alaa" and password=="1234":
|
| 39 |
return True
|
| 40 |
|
| 41 |
+
def plan2img(plan):
|
| 42 |
+
if 'foundation' in plan.lower():
|
| 43 |
+
noTextImg=rmv_text(plan)
|
| 44 |
+
clean_img=rmv_dashedLines(noTextImg)
|
| 45 |
+
return clean_img
|
| 46 |
|
| 47 |
+
else:
|
| 48 |
+
# fname = plan
|
| 49 |
+
#op='pictures/found.png'
|
| 50 |
+
doc = fitz.open(plan)
|
| 51 |
+
for page in doc:
|
| 52 |
+
pix = page.get_pixmap(dpi=200) # render page to an image
|
| 53 |
+
pl=Image.frombytes('RGB', [pix.width,pix.height],pix.samples)
|
| 54 |
+
pl1=np.array(pl)
|
| 55 |
+
# pix = page.get_pixmap() # render page to an image
|
| 56 |
+
return pl1
|
| 57 |
|
| 58 |
# path='/content/drive/MyDrive/Colab Notebooks/Pile caps plans/13886-CRH-B3-FN-DR-S-31001 - Copy.pdf'
|
| 59 |
|