File size: 1,986 Bytes
39debef
3170d22
 
 
0715e8c
 
3170d22
 
 
 
0715e8c
39debef
8ed86f2
3170d22
8ed86f2
3cf084f
3170d22
8ed86f2
3170d22
 
cf4de60
 
6494a0c
8c0dd07
0715e8c
76a2d16
cf4de60
8c0dd07
6494a0c
 
 
76a2d16
3170d22
76a2d16
96b4bfb
a3cfe41
6494a0c
8c0dd07
83d3f47
a3cfe41
3170d22
 
83d3f47
3170d22
6494a0c
 
 
3170d22
 
54614fc
ccd51f8
3170d22
 
83d3f47
3170d22
72fe07e
83d3f47
3170d22
 
 
 
ccd51f8
72fe07e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import streamlit as st
from PIL import Image
import random
import sahi.utils.file
import pandas as pd

IMAGE_TO_URL = {
    'factory_pid.png' : 'https://d1afc1j4569hs1.cloudfront.net/factory-pid.png',
    'plant_pid.png' : 'https://d1afc1j4569hs1.cloudfront.net/plant-pid.png',
    'processing_pid.png' : 'https://d1afc1j4569hs1.cloudfront.net/processing-pid.png'
    }

st.set_page_config(
    page_title="P&ID Object Detection",
    layout="wide",
    initial_sidebar_state="expanded"
    )

st.title('P&ID Object Detection')
st.subheader(' Identify valves and pumps with deep learning model ', divider='rainbow')
st.caption('Developed by Deep Drawings Co.')

col1, col2, col3 = st.columns(3, gap='large')
with col1:
    with st.expander('How to use it'):
        st.markdown(
        '''
        1) Upload your P&ID or select example diagrams 📬
        2) Set confidence threshold 📈
        3) Press to perform inference 🚀
        4) Visualize model predictions 🔎
        '''
        )   

st.write('##')
    
col1, col2, col3, col4 = st.columns([1, 2, 2, 1], gap='large')
with col2:
    st.markdown('##### Input File')
    # set input image by upload
    image_file = st.file_uploader("Upload your diagram", type=["pdf"])
    # set input images from examples
    def radio_func(option):
        option_to_id = {
            'factory_pid.png' : 'Example N°1',
            'plant_pid.png' : 'Example N°2',
            'processing_pid.png' : 'Example N°3',
        }
        return option_to_id[option]
    st.write('##')
    radio = st.radio(
        'Or select from example diagrams',
        options = ['factory_pid.png', 'plant_pid.png', 'processing_pid.png'],
        format_func = radio_func,
    )
with col3:
    st.markdown('##### Preview')
    # visualize input image
    if image_file is not None:
        image = Image.open(image_file)
    else:
        image = sahi.utils.cv.read_image_as_pil(IMAGE_TO_URL[radio])
    st.image(image, use_column_width = True)