Spaces:
Sleeping
Sleeping
Daniel Cerda Escobar
commited on
Commit
·
d063ffc
1
Parent(s):
37c2466
Update front
Browse files
app.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
|
|
|
|
3 |
import sahi.utils.file
|
4 |
from PIL import Image
|
5 |
from sahi import AutoDetectionModel
|
6 |
from utils import sahi_yolov8m_inference
|
7 |
-
from streamlit_image_comparison import image_comparison
|
8 |
from ultralyticsplus.hf_utils import download_from_hub
|
9 |
|
10 |
IMAGE_TO_URL = {
|
@@ -204,6 +205,8 @@ with col2:
|
|
204 |
col1,col2,col3 = st.columns([1,4,1])
|
205 |
with col2:
|
206 |
chart_data = st.session_state["output_4"]
|
207 |
-
|
|
|
|
|
208 |
|
209 |
|
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
3 |
+
import seaborn as sns
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
import sahi.utils.file
|
6 |
from PIL import Image
|
7 |
from sahi import AutoDetectionModel
|
8 |
from utils import sahi_yolov8m_inference
|
|
|
9 |
from ultralyticsplus.hf_utils import download_from_hub
|
10 |
|
11 |
IMAGE_TO_URL = {
|
|
|
205 |
col1,col2,col3 = st.columns([1,4,1])
|
206 |
with col2:
|
207 |
chart_data = st.session_state["output_4"]
|
208 |
+
bar_plot = sns.barplot(x='count', y='category', data=chart_data)
|
209 |
+
st.pyplot(bar_plot.figure, use_container_width=True)
|
210 |
+
#st.bar_chart(chart_data[['category','count']], x='category', y='count', use_container_width=True)
|
211 |
|
212 |
|
utils.py
CHANGED
@@ -52,7 +52,5 @@ def sahi_yolov8m_inference(
|
|
52 |
category_counts.columns = ['category', 'count']
|
53 |
# update the `count` column in the base DataFrame
|
54 |
output_df['count'] = output_df['category'].map(category_counts.set_index('category')['count']).fillna(0).astype(int)
|
55 |
-
# calculate percentages
|
56 |
-
output_df['percentage'] = round((output_df['count'] / output_df['count'].sum()) * 100, 1)
|
57 |
|
58 |
return output_visual,coco_df,output_df
|
|
|
52 |
category_counts.columns = ['category', 'count']
|
53 |
# update the `count` column in the base DataFrame
|
54 |
output_df['count'] = output_df['category'].map(category_counts.set_index('category')['count']).fillna(0).astype(int)
|
|
|
|
|
55 |
|
56 |
return output_visual,coco_df,output_df
|