Daniel Cerda Escobar commited on
Commit
4d1e216
Β·
1 Parent(s): 117d139

Update app file

Browse files
Files changed (1) hide show
  1. app.py +31 -32
app.py CHANGED
@@ -25,40 +25,39 @@ with col1:
25
  with st.expander('How to use it'):
26
  st.markdown(
27
  '''
28
- 1) Upload your P&ID or select example diagrams πŸ“¬
29
  2) Set confidence threshold πŸ“ˆ
30
- 3) Press to perform inference πŸš€
31
- 4) Visualize model predictions πŸ”Ž
32
  '''
33
  )
34
 
35
  st.write('##')
36
-
37
- with st.container(border = True):
38
- col1, col2, col3, col4 = st.columns([1, 2, 2, 1], gap='large')
39
- with col2:
40
- st.markdown('##### Input File')
41
- # set input image by upload
42
- image_file = st.file_uploader("Upload your diagram", type=["pdf"])
43
- # set input images from examples
44
- def radio_func(option):
45
- option_to_id = {
46
- 'factory_pid.png' : 'A',
47
- 'plant_pid.png' : 'B',
48
- 'processing_pid.png' : 'C',
49
- }
50
- return option_to_id[option]
51
- radio = st.radio(
52
- 'Or select from example diagrams',
53
- options = ['factory_pid.png', 'plant_pid.png', 'processing_pid.png'],
54
- format_func = radio_func,
55
- )
56
- with col3:
57
- st.markdown('##### Preview')
58
- # visualize input image
59
- if image_file is not None:
60
- image = Image.open(image_file)
61
- else:
62
- image = sahi.utils.cv.read_image_as_pil(IMAGE_TO_URL[radio])
63
- with st.container(border = True):
64
- st.image(image, use_column_width = True)
 
25
  with st.expander('How to use it'):
26
  st.markdown(
27
  '''
28
+ 1) Upload your P&ID or select example diagrams πŸ“¬
29
  2) Set confidence threshold πŸ“ˆ
30
+ 3) Press to perform inference πŸš€
31
+ 4) Visualize model predictions πŸ”Ž
32
  '''
33
  )
34
 
35
  st.write('##')
36
+
37
+ col1, col2, col3, col4 = st.columns([1, 2, 2, 1], gap='large')
38
+ with col2:
39
+ st.markdown('##### Input File')
40
+ # set input image by upload
41
+ image_file = st.file_uploader("Upload your diagram", type=["pdf"])
42
+ # set input images from examples
43
+ def radio_func(option):
44
+ option_to_id = {
45
+ 'factory_pid.png' : 'A',
46
+ 'plant_pid.png' : 'B',
47
+ 'processing_pid.png' : 'C',
48
+ }
49
+ return option_to_id[option]
50
+ radio = st.radio(
51
+ 'Or select from the following examples',
52
+ options = ['factory_pid.png', 'plant_pid.png', 'processing_pid.png'],
53
+ format_func = radio_func,
54
+ )
55
+ with col3:
56
+ st.markdown('##### Preview')
57
+ # visualize input image
58
+ if image_file is not None:
59
+ image = Image.open(image_file)
60
+ else:
61
+ image = sahi.utils.cv.read_image_as_pil(IMAGE_TO_URL[radio])
62
+ with st.container(border = True):
63
+ st.image(image, use_column_width = True)