Spaces:
Runtime error
Runtime error
Upload demo-slides.ipynb
Browse files- demo-slides.ipynb +137 -0
demo-slides.ipynb
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": null,
|
6 |
+
"id": "18f75bbd",
|
7 |
+
"metadata": {
|
8 |
+
"slideshow": {
|
9 |
+
"slide_type": "skip"
|
10 |
+
}
|
11 |
+
},
|
12 |
+
"outputs": [],
|
13 |
+
"source": [
|
14 |
+
"import mercury as mr\n",
|
15 |
+
"import numpy as np\n",
|
16 |
+
"from matplotlib import pyplot as plt\n",
|
17 |
+
"\n",
|
18 |
+
"app = mr.App(title=\"Slides demo π\", description=\"Wouldn't it be amazing to recompute slides during the show?\") "
|
19 |
+
]
|
20 |
+
},
|
21 |
+
{
|
22 |
+
"cell_type": "markdown",
|
23 |
+
"id": "b6406aef",
|
24 |
+
"metadata": {
|
25 |
+
"slideshow": {
|
26 |
+
"slide_type": "slide"
|
27 |
+
}
|
28 |
+
},
|
29 |
+
"source": [
|
30 |
+
"# Interactive presentation π"
|
31 |
+
]
|
32 |
+
},
|
33 |
+
{
|
34 |
+
"cell_type": "markdown",
|
35 |
+
"id": "356881ce",
|
36 |
+
"metadata": {
|
37 |
+
"slideshow": {
|
38 |
+
"slide_type": "slide"
|
39 |
+
}
|
40 |
+
},
|
41 |
+
"source": [
|
42 |
+
"## Recompute slides π₯οΈ\n",
|
43 |
+
"\n",
|
44 |
+
"- You can create interactive presentation with Mercury\n",
|
45 |
+
"- Users can recompute slides by changing widgets\n",
|
46 |
+
"- You can enter full screen by pressing **F** and exit with **Esc**\n",
|
47 |
+
"- Please check next slides β‘οΈ\n",
|
48 |
+
"\n"
|
49 |
+
]
|
50 |
+
},
|
51 |
+
{
|
52 |
+
"cell_type": "code",
|
53 |
+
"execution_count": null,
|
54 |
+
"id": "ab8b6a12",
|
55 |
+
"metadata": {
|
56 |
+
"slideshow": {
|
57 |
+
"slide_type": "skip"
|
58 |
+
}
|
59 |
+
},
|
60 |
+
"outputs": [],
|
61 |
+
"source": [
|
62 |
+
"name = mr.Text(label=\"What is your name?\", value=\"Piotr\")"
|
63 |
+
]
|
64 |
+
},
|
65 |
+
{
|
66 |
+
"cell_type": "code",
|
67 |
+
"execution_count": null,
|
68 |
+
"id": "1e35109c",
|
69 |
+
"metadata": {
|
70 |
+
"slideshow": {
|
71 |
+
"slide_type": "slide"
|
72 |
+
}
|
73 |
+
},
|
74 |
+
"outputs": [],
|
75 |
+
"source": [
|
76 |
+
"mr.Markdown(f\"\"\"## Hello {name.value}!\n",
|
77 |
+
"\n",
|
78 |
+
"{name.value}, this slide is recomputed after name change in the left side bar.\n",
|
79 |
+
"\n",
|
80 |
+
"Please change the name value in the left side bar and press **Enter**.\n",
|
81 |
+
"\n",
|
82 |
+
"Please check next slide β‘οΈ\n",
|
83 |
+
"\n",
|
84 |
+
"\"\"\")"
|
85 |
+
]
|
86 |
+
},
|
87 |
+
{
|
88 |
+
"cell_type": "code",
|
89 |
+
"execution_count": null,
|
90 |
+
"id": "f73fb730",
|
91 |
+
"metadata": {
|
92 |
+
"slideshow": {
|
93 |
+
"slide_type": "skip"
|
94 |
+
}
|
95 |
+
},
|
96 |
+
"outputs": [],
|
97 |
+
"source": [
|
98 |
+
"samples = mr.Slider(label=\"How many samples\", value=75, min=50, max=100)\n",
|
99 |
+
"color = mr.Select(label=\"Mark color\", value=\"blue\", choices=[\"blue\", \"green\", \"red\"])\n"
|
100 |
+
]
|
101 |
+
},
|
102 |
+
{
|
103 |
+
"cell_type": "code",
|
104 |
+
"execution_count": null,
|
105 |
+
"id": "91b9e0a2",
|
106 |
+
"metadata": {
|
107 |
+
"slideshow": {
|
108 |
+
"slide_type": "slide"
|
109 |
+
}
|
110 |
+
},
|
111 |
+
"outputs": [],
|
112 |
+
"source": [
|
113 |
+
"mr.Markdown(\"\"\"## Scatter plot π²\n",
|
114 |
+
"Please change number of samples and mark color in the left side bar. The plot will be updated during the slide show.\"\"\")\n",
|
115 |
+
"_ = plt.plot(np.random.rand(samples.value), np.random.rand(samples.value), \"*\", color=color.value)"
|
116 |
+
]
|
117 |
+
},
|
118 |
+
{
|
119 |
+
"cell_type": "markdown",
|
120 |
+
"id": "d90d721e",
|
121 |
+
"metadata": {
|
122 |
+
"slideshow": {
|
123 |
+
"slide_type": "slide"
|
124 |
+
}
|
125 |
+
},
|
126 |
+
"source": [
|
127 |
+
"## Thank you!\n",
|
128 |
+
" \n",
|
129 |
+
"Please check our documentation at <a href=\"https://runmercury.com\" target=\"_blank\">RunMercury.com</a> for more information π\n",
|
130 |
+
"\n"
|
131 |
+
]
|
132 |
+
}
|
133 |
+
],
|
134 |
+
"metadata": {},
|
135 |
+
"nbformat": 4,
|
136 |
+
"nbformat_minor": 5
|
137 |
+
}
|