File tree Expand file tree Collapse file tree 2 files changed +50
-25
lines changed
apps/99_streamlit_examples/pages Expand file tree Collapse file tree 2 files changed +50
-25
lines changed Original file line number Diff line number Diff line change 18
18
key = "model_name" ,
19
19
index = 0 ,
20
20
)
21
+ data_source = st .selectbox (
22
+ label = "Select a data source" ,
23
+ options = [
24
+ "file" ,
25
+ "camera" ,
26
+ ],
27
+ key = "data_source" ,
28
+ index = 0 ,
29
+ )
21
30
22
31
23
32
st .title ("Object detection" )
24
33
25
- st .info ("Upload an image and AI will detect objects in the image." )
26
-
27
- uploaded_file = st .file_uploader (
28
- "Upload an image" ,
29
- type = (
30
- "jpg" ,
31
- "jpeg" ,
32
- "png" ,
33
- "gif" ,
34
- "bmp" ,
35
- "tiff" ,
36
- ),
37
- )
34
+ if data_source == "camera" :
35
+ st .info ("AI will detect objects in the camera image." )
36
+ uploaded_file = st .camera_input ("Take a picture" )
37
+ if data_source == "file" :
38
+ st .info ("Upload an image and AI will detect objects in the image." )
39
+ uploaded_file = st .file_uploader (
40
+ "Upload an image" ,
41
+ type = (
42
+ "jpg" ,
43
+ "jpeg" ,
44
+ "png" ,
45
+ "gif" ,
46
+ "bmp" ,
47
+ "tiff" ,
48
+ ),
49
+ )
38
50
if uploaded_file is not None :
39
51
button = st .button ("Detect objects" )
40
52
Original file line number Diff line number Diff line change 28
28
index = 1 ,
29
29
key = "model_complexity" ,
30
30
)
31
+ data_source = st .selectbox (
32
+ label = "Select a data source" ,
33
+ options = [
34
+ "file" ,
35
+ "camera" ,
36
+ ],
37
+ key = "data_source" ,
38
+ index = 0 ,
39
+ )
31
40
32
41
33
42
st .title ("Pose estimation" )
34
43
35
- st .info ("Upload an image and AI will estimate the pose." )
44
+ if data_source == "camera" :
45
+ st .info ("AI will detect objects in the camera image." )
46
+ uploaded_file = st .camera_input ("Take a picture" )
47
+ if data_source == "file" :
48
+ st .info ("Upload an image and AI will estimate the pose." )
49
+ uploaded_file = st .file_uploader (
50
+ "Upload an image" ,
51
+ type = (
52
+ "jpg" ,
53
+ "jpeg" ,
54
+ "png" ,
55
+ "gif" ,
56
+ "bmp" ,
57
+ "tiff" ,
58
+ ),
59
+ )
36
60
37
- uploaded_file = st .file_uploader (
38
- "Upload an image" ,
39
- type = (
40
- "jpg" ,
41
- "jpeg" ,
42
- "png" ,
43
- "gif" ,
44
- "bmp" ,
45
- "tiff" ,
46
- ),
47
- )
48
61
if uploaded_file is not None :
49
62
button = st .button ("Estimate pose" )
50
63
You can’t perform that action at this time.
0 commit comments