Rich Media
Datapane allows you to include many different types of content in your report, such as code, LaTeX formulas, images, embeds, HTML and more. See an example below:
1
import datapane as dp
2
3
html = """
4
<html>
5
<style type='text/css'>
6
@keyframes example {
7
0% {color: #EEE;}
8
25% {color: #EC4899;}
9
50% {color: #8B5CF6;}
10
100% {color: #EF4444;}
11
}
12
#container {
13
background: #1F2937;
14
padding: 10em;
15
}
16
h1 {
17
color:#eee;
18
animation-name: example;
19
animation-duration: 4s;
20
animation-iteration-count: infinite;
21
}
22
</style>
23
<div id="container">
24
<h1> Welcome to my Report </h1>
25
</div>
26
</html>
27
"""
28
29
obj_dict = {
30
"brand": "Ford",
31
"model": "Mustang",
32
"year": 1964
33
}
34
35
report = dp.Report(
36
dp.Text("""
37
## Example report with rich media
38
"""),
39
dp.Formula("x^2 + y^2 = z^2"),
40
dp.Code("""
41
# This is a snippet of Python code
42
def hello_world():
43
print("Hello world")
44
45
hello_world()
46
"""),
47
dp.HTML(html),
48
dp.Embed(url='https://www.youtube.com/watch?v=dQw4w9WgXcQ'),
49
dp.File(obj_dict, is_json=True)
50
)
51
52
report.upload(name="Rich Media")
Copied!
Running that code generates the following report:
Last modified 2mo ago
Copy link