vtablas001 commited on
Commit
be66cb9
1 Parent(s): 511a575

updates to app.py

Browse files
Files changed (2) hide show
  1. app.py +31 -1
  2. requirements.txt +2 -1
app.py CHANGED
@@ -117,4 +117,34 @@ if archivo_imagen is not None:
117
  st.subheader("Segmentaci贸n:")
118
  st.write(output.shape)
119
  st.image(output, width=850)
120
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  st.subheader("Segmentaci贸n:")
118
  st.write(output.shape)
119
  st.image(output, width=850)
120
+
121
+
122
+ ## This will provide a dashboard
123
+ st.subheader("Diagnostic metrics overview")
124
+
125
+ conteo_dientes = len(cnts)
126
+ area_total = np.sum(mask > 0)
127
+ area_promedio = area_total / conteo_dientes if conteo_dientes > 0 else 0
128
+
129
+ col_m1, col_m2, col_m3 = st.columns(3)
130
+ col_m1.metric("Tooth count", conteo_dientes)
131
+ col_m2.metric("Total dental area (px)", f"{area_total:,}")
132
+ col_m3.metric("Average tooth area (px)", f"{int(area_promedio):,}")
133
+
134
+ st.markdown("### Detected instances data")
135
+
136
+ datos_dientes = []
137
+ for i, c in enumerate(cnts):
138
+ area = cv2.contourArea(c)
139
+ x, y, w, h = cv2.boundingRect(c)
140
+ datos_dientes.append({
141
+ "ID": i + 1,
142
+ "Area (px)": area,
143
+ "Width (px)": w,
144
+ "Height (px)": h
145
+ })
146
+
147
+ import pandas as pd
148
+ df_dientes = pd.DataFrame(datos_dientes)
149
+ st.dataframe(df_dientes, use_container_width=True)
150
+
requirements.txt CHANGED
@@ -1,4 +1,5 @@
1
  streamlit
2
  huggingface_hub==0.21.4
3
  tensorflow==2.15.0
4
- opencv-python-headless
 
 
1
  streamlit
2
  huggingface_hub==0.21.4
3
  tensorflow==2.15.0
4
+ opencv-python-headless
5
+ pandas