Spaces:
Sleeping
Sleeping
Daniel Cerda Escobar
commited on
Commit
Β·
ee620ac
1
Parent(s):
986adf5
Update Space"
Browse files
app.py
CHANGED
|
@@ -64,7 +64,7 @@ with col1:
|
|
| 64 |
with st.expander('How to use it'):
|
| 65 |
st.markdown(
|
| 66 |
'''
|
| 67 |
-
1)
|
| 68 |
2) Set confidence threshold π
|
| 69 |
3) Press to perform inference π
|
| 70 |
4) Visualize model predictions π
|
|
@@ -75,14 +75,14 @@ st.write('##')
|
|
| 75 |
|
| 76 |
col1, col2, col3 = st.columns(3, gap='large')
|
| 77 |
with col1:
|
| 78 |
-
st.markdown('##### Input File')
|
| 79 |
# set input image by upload
|
| 80 |
-
uploaded_file = st.file_uploader("Upload your diagram", type="pdf")
|
| 81 |
-
if uploaded_file:
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
# set input images from examples
|
| 87 |
def radio_func(option):
|
| 88 |
option_to_id = {
|
|
@@ -92,7 +92,7 @@ with col1:
|
|
| 92 |
}
|
| 93 |
return option_to_id[option]
|
| 94 |
radio = st.radio(
|
| 95 |
-
'
|
| 96 |
options = ['factory_pid.png', 'plant_pid.png', 'processing_pid.png'],
|
| 97 |
format_func = radio_func,
|
| 98 |
)
|
|
|
|
| 64 |
with st.expander('How to use it'):
|
| 65 |
st.markdown(
|
| 66 |
'''
|
| 67 |
+
1) Select any example diagram π¬
|
| 68 |
2) Set confidence threshold π
|
| 69 |
3) Press to perform inference π
|
| 70 |
4) Visualize model predictions π
|
|
|
|
| 75 |
|
| 76 |
col1, col2, col3 = st.columns(3, gap='large')
|
| 77 |
with col1:
|
| 78 |
+
#st.markdown('##### Input File')
|
| 79 |
# set input image by upload
|
| 80 |
+
#uploaded_file = st.file_uploader("Upload your diagram", type="pdf")
|
| 81 |
+
#if uploaded_file:
|
| 82 |
+
# temp_dir = tempfile.mkdtemp()
|
| 83 |
+
# path = os.path.join(temp_dir, uploaded_file.name)
|
| 84 |
+
# with open(path, "wb") as f:
|
| 85 |
+
# f.write(uploaded_file.getvalue())
|
| 86 |
# set input images from examples
|
| 87 |
def radio_func(option):
|
| 88 |
option_to_id = {
|
|
|
|
| 92 |
}
|
| 93 |
return option_to_id[option]
|
| 94 |
radio = st.radio(
|
| 95 |
+
'Select from the following examples',
|
| 96 |
options = ['factory_pid.png', 'plant_pid.png', 'processing_pid.png'],
|
| 97 |
format_func = radio_func,
|
| 98 |
)
|
utils.py
CHANGED
|
@@ -13,8 +13,8 @@ def sahi_yolov8m_inference(
|
|
| 13 |
detection_model,
|
| 14 |
slice_height=512,
|
| 15 |
slice_width=512,
|
| 16 |
-
overlap_height_ratio=0.
|
| 17 |
-
overlap_width_ratio=0.
|
| 18 |
image_size=640,
|
| 19 |
postprocess_match_threshold=0.5,
|
| 20 |
):
|
|
|
|
| 13 |
detection_model,
|
| 14 |
slice_height=512,
|
| 15 |
slice_width=512,
|
| 16 |
+
overlap_height_ratio=0.1,
|
| 17 |
+
overlap_width_ratio=0.1,
|
| 18 |
image_size=640,
|
| 19 |
postprocess_match_threshold=0.5,
|
| 20 |
):
|