Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,6 +22,7 @@ file_name = st.file_uploader("Upload a report image")
|
|
| 22 |
|
| 23 |
if file_name is not None:
|
| 24 |
col1, col2 = st.columns(2)
|
|
|
|
| 25 |
|
| 26 |
image = Image.open(file_name)
|
| 27 |
input_image, copy_img= process_img(image)
|
|
@@ -38,7 +39,7 @@ if file_name is not None:
|
|
| 38 |
if confidance[i] >= threshold:
|
| 39 |
x1,y1,x2,y2 = bbox[i]*640
|
| 40 |
class_name = labels[int(classes[i])]
|
| 41 |
-
|
| 42 |
if class_name =="Header":
|
| 43 |
header_count+=1
|
| 44 |
color = (0,0,255) #Blue color
|
|
@@ -53,9 +54,9 @@ if file_name is not None:
|
|
| 53 |
table_count+=1
|
| 54 |
color = (255,0,0) #Red color
|
| 55 |
cv2.rectangle(copy_img, (int(x1), int(y1)), (int(x2), int(y2)),color, 2)
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
col2.header("Output Result")
|
| 60 |
col2.image(copy_img, use_column_width=True)
|
| 61 |
|
|
|
|
| 22 |
|
| 23 |
if file_name is not None:
|
| 24 |
col1, col2 = st.columns(2)
|
| 25 |
+
col3, col4 = st.columns(2)
|
| 26 |
|
| 27 |
image = Image.open(file_name)
|
| 28 |
input_image, copy_img= process_img(image)
|
|
|
|
| 39 |
if confidance[i] >= threshold:
|
| 40 |
x1,y1,x2,y2 = bbox[i]*640
|
| 41 |
class_name = labels[int(classes[i])]
|
| 42 |
+
col3.text(class_name+" : "+str(int(confidance[i]*100))+"%")
|
| 43 |
if class_name =="Header":
|
| 44 |
header_count+=1
|
| 45 |
color = (0,0,255) #Blue color
|
|
|
|
| 54 |
table_count+=1
|
| 55 |
color = (255,0,0) #Red color
|
| 56 |
cv2.rectangle(copy_img, (int(x1), int(y1)), (int(x2), int(y2)),color, 2)
|
| 57 |
+
col4.text("No of Table Detected : "+str(table_count))
|
| 58 |
+
col4.text("No of Header Detected : "+str(header_count))
|
| 59 |
+
col4.text("No of Column Detected : "+str(column_count))
|
| 60 |
col2.header("Output Result")
|
| 61 |
col2.image(copy_img, use_column_width=True)
|
| 62 |
|