Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from bokeh.plotting import figure
|
3 |
+
from bokeh.models import ColumnDataSource, HoverTool
|
4 |
+
|
5 |
+
# Example data
|
6 |
+
data = {
|
7 |
+
'x': [1, 2, 3, 4, 5],
|
8 |
+
'y': [10, 14, 20, 25, 30],
|
9 |
+
'label': ['Point 1', 'Point 2', 'Point 3', 'Point 4', 'Point 5'],
|
10 |
+
'image': [
|
11 |
+
'https://media-img.lucyinthesky.com/data/Nov24/560xAUTO/17157eb1-aba8-4161-8a44-2dd3bd73a5ff.jpg',
|
12 |
+
'https://media-img.lucyinthesky.com/data/Nov24/560xAUTO/dfd0c2d3-af96-4700-8fb2-cccc585c0e8b.jpg',
|
13 |
+
'https://media-img.lucyinthesky.com/data/Nov24/560xAUTO/ef942b7d-52ad-415b-ae88-c7c29a2491b4.jpg',
|
14 |
+
'https://media-img.lucyinthesky.com/data/Nov24/560xAUTO/047928d0-9168-4d29-84a5-785aec57dd6b.jpg',
|
15 |
+
'https://media-img.lucyinthesky.com/data/Nov24/560xAUTO/03054e31-3812-454a-bc3a-0ff207798927.jpg'
|
16 |
+
]
|
17 |
+
}
|
18 |
+
|
19 |
+
source = ColumnDataSource(data=data)
|
20 |
+
|
21 |
+
# Create figure
|
22 |
+
p = figure(title="Scatter Plot with Image Hover", tools="hover", tooltips="""
|
23 |
+
<div>
|
24 |
+
<div><strong>@label</strong></div>
|
25 |
+
<div><img src="@image" style="width:200px;height:200px;"></div>
|
26 |
+
</div>
|
27 |
+
""")
|
28 |
+
p.circle('x', 'y', size=10, source=source)
|
29 |
+
|
30 |
+
# Display the Bokeh figure in Streamlit
|
31 |
+
st.bokeh_chart(p)
|