-
Notifications
You must be signed in to change notification settings - Fork 11
/
streamlit_app.py
75 lines (54 loc) · 1.49 KB
/
streamlit_app.py
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
64
65
66
67
68
69
70
71
72
73
74
75
import streamlit as st
from PIL import Image
from streamlit_image_coordinates import streamlit_image_coordinates
st.set_page_config(
page_title="Streamlit Image Coordinates",
page_icon="🎯",
layout="wide",
)
"# :dart: Streamlit Image Coordinates"
st.code("pip install streamlit-image-coordinates")
"Try clicking on any of the images below."
col1, col2, col3, col4 = st.columns(4)
with col1:
st.write("## Url example")
with st.echo("below"):
value = streamlit_image_coordinates(
"https://placecats.com/200/300",
key="url",
)
st.write(value)
with col2:
st.write("## Local image example")
with st.echo("below"):
value = streamlit_image_coordinates(
"kitty.jpeg",
key="local",
)
st.write(value)
with col3:
st.write("## Custom size example")
with st.echo("below"):
value = streamlit_image_coordinates(
"kitty.jpeg",
width=250,
key="local2",
)
st.write(value)
with col4:
st.write("## PIL example")
with st.echo("below"):
value = streamlit_image_coordinates(
Image.open("kitty.jpeg"),
key="pil",
)
st.write(value)
st.write("## Full width example with click and drag")
with st.echo("below"):
value = streamlit_image_coordinates(
"kitty.jpeg",
key="local4",
use_column_width="always",
click_and_drag=True,
)
st.write(value)