pplonski commited on
Commit
5780425
β€’
1 Parent(s): d5a6775

Upload 4 files

Browse files
Files changed (4) hide show
  1. demo-dataframe-and-plots.ipynb +130 -0
  2. demo-slides.ipynb +137 -0
  3. demo.ipynb +59 -0
  4. welcome.md +27 -0
demo-dataframe-and-plots.ipynb ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "f7a8a4a6",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import pandas as pd\n",
11
+ "import numpy as np\n",
12
+ "from matplotlib import pyplot as plt"
13
+ ]
14
+ },
15
+ {
16
+ "cell_type": "code",
17
+ "execution_count": null,
18
+ "id": "af5151e2",
19
+ "metadata": {},
20
+ "outputs": [],
21
+ "source": [
22
+ "import mercury as mr"
23
+ ]
24
+ },
25
+ {
26
+ "cell_type": "code",
27
+ "execution_count": null,
28
+ "id": "5a9fc098",
29
+ "metadata": {},
30
+ "outputs": [],
31
+ "source": [
32
+ "# control app with App class\n",
33
+ "app = mr.App(title=\"DataFrame & Plots πŸš€\", description=\"Showcase of Mercury Widgets\", show_code = False)"
34
+ ]
35
+ },
36
+ {
37
+ "cell_type": "markdown",
38
+ "id": "5ca6e6ea",
39
+ "metadata": {},
40
+ "source": [
41
+ "# DataFrame and Plots πŸŽ²πŸ“Š\n",
42
+ "\n",
43
+ "Share your notebooks with everyone thanks to Mercury framework.\n",
44
+ "\n",
45
+ "Please change number of samples and number of features in the left side bar. Notebook will be recomputed after widget change."
46
+ ]
47
+ },
48
+ {
49
+ "cell_type": "code",
50
+ "execution_count": null,
51
+ "id": "8182572d",
52
+ "metadata": {},
53
+ "outputs": [],
54
+ "source": [
55
+ "samples = mr.Slider(label=\"Number of samples\", min=50, max=100, value=75)\n",
56
+ "features = mr.Select(label=\"Number of features\", choices=[\"5\", \"10\", \"15\"], value=\"10\")"
57
+ ]
58
+ },
59
+ {
60
+ "cell_type": "code",
61
+ "execution_count": null,
62
+ "id": "efc441f6",
63
+ "metadata": {},
64
+ "outputs": [],
65
+ "source": [
66
+ "data = {}\n",
67
+ "for i in range(int(features.value)):\n",
68
+ " data[f\"Feature {i}\"] = np.random.rand(samples.value)\n",
69
+ "df = pd.DataFrame(data)"
70
+ ]
71
+ },
72
+ {
73
+ "cell_type": "markdown",
74
+ "id": "eba6526e",
75
+ "metadata": {},
76
+ "source": [
77
+ "## Random data 🎲"
78
+ ]
79
+ },
80
+ {
81
+ "cell_type": "code",
82
+ "execution_count": null,
83
+ "id": "638de41f",
84
+ "metadata": {},
85
+ "outputs": [],
86
+ "source": [
87
+ "df"
88
+ ]
89
+ },
90
+ {
91
+ "cell_type": "markdown",
92
+ "id": "cef87336",
93
+ "metadata": {},
94
+ "source": [
95
+ "## Scatter plot πŸ“ˆ"
96
+ ]
97
+ },
98
+ {
99
+ "cell_type": "code",
100
+ "execution_count": null,
101
+ "id": "03ab6214",
102
+ "metadata": {},
103
+ "outputs": [],
104
+ "source": [
105
+ "_ = plt.plot(df[\"Feature 1\"], df[\"Feature 2\"], '*')"
106
+ ]
107
+ },
108
+ {
109
+ "cell_type": "markdown",
110
+ "id": "e42d394b",
111
+ "metadata": {},
112
+ "source": [
113
+ "## Random data histogram πŸ“Š"
114
+ ]
115
+ },
116
+ {
117
+ "cell_type": "code",
118
+ "execution_count": null,
119
+ "id": "6a88f486",
120
+ "metadata": {},
121
+ "outputs": [],
122
+ "source": [
123
+ "_ = plt.hist(df[\"Feature 1\"], bins=40)"
124
+ ]
125
+ }
126
+ ],
127
+ "metadata": {},
128
+ "nbformat": 4,
129
+ "nbformat_minor": 5
130
+ }
demo-slides.ipynb ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "a17a3277",
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": "44fa382c",
24
+ "metadata": {
25
+ "slideshow": {
26
+ "slide_type": "slide"
27
+ }
28
+ },
29
+ "source": [
30
+ "# Interactive presentation πŸ“"
31
+ ]
32
+ },
33
+ {
34
+ "cell_type": "markdown",
35
+ "id": "eb27c85b",
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": "86c79f3e",
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": "c5f30726",
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": "3c6a0cb4",
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": "1b4f4408",
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": "017d36e9",
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
+ }
demo.ipynb ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "07755adf",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import mercury as mr\n",
11
+ "app = mr.App(title=\"Hello demo πŸ‘‹\", description=\"Hello demo with Text widget\", show_code=True)\n"
12
+ ]
13
+ },
14
+ {
15
+ "cell_type": "markdown",
16
+ "id": "03e09236",
17
+ "metadata": {},
18
+ "source": [
19
+ "# Mercury demo πŸ‘‹\n",
20
+ "\n",
21
+ "Share your notebooks with everyone thanks to Mercury framework!\n",
22
+ "\n",
23
+ "Please write your name in the left side bar and press **Enter** ⌨️ \n",
24
+ "\n",
25
+ "The notebook will be automatically recomputed. Only cells with widget definition and below are recomputed. That's why it is fast!\n",
26
+ "\n",
27
+ "You can download executed notebook as HTML or PDF (just click in the left side bar).\n",
28
+ "\n",
29
+ "You can edit this notebook in the Jupyter Notebook, and changes will appear instantly in the Mercury.\n"
30
+ ]
31
+ },
32
+ {
33
+ "cell_type": "code",
34
+ "execution_count": null,
35
+ "id": "9157de6f",
36
+ "metadata": {},
37
+ "outputs": [],
38
+ "source": [
39
+ "name = mr.Text(label=\"What is you name?\", value=\"Piotr\")"
40
+ ]
41
+ },
42
+ {
43
+ "cell_type": "code",
44
+ "execution_count": null,
45
+ "id": "df533a46",
46
+ "metadata": {},
47
+ "outputs": [],
48
+ "source": [
49
+ "mr.Markdown(f\"\"\"## Hello {name.value}! \n",
50
+ "\n",
51
+ "For more examples please check our documentation at <a href=\"https://runmercury.com\" target=\"_blank\">RunMercury.com<a> πŸ“š\n",
52
+ "\"\"\")"
53
+ ]
54
+ }
55
+ ],
56
+ "metadata": {},
57
+ "nbformat": 4,
58
+ "nbformat_minor": 5
59
+ }
welcome.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Welcome in Mercury πŸ‘‹
3
+
4
+ Mercury framework allows you easily turn Jupyter Notebooks into shareble web applications.
5
+
6
+ You can create beautiful and interactive web applications, reports, dashboards and presentations.
7
+
8
+ Mercury features:
9
+ - add widgets with simple Python API,
10
+ - simple cell execution model - widgets trigger cell execution below the widget definition,
11
+ - hide or show notebook code,
12
+ - share multiple notebooks,
13
+ - executed notebook can be exported to HTML or PDF,
14
+ - embed notebook apps on any website,
15
+ - easily deploy (free & public Mercury cloud comming soon!)
16
+ - easily add authentication to notebooks (comming soon!)
17
+ - schedule automatic execution (comming soon!)
18
+
19
+ Please check our documentation at <a href="https://runmercury.com" target="_blank">RunMercury.com</a> for more information πŸ“š
20
+
21
+ This text can be edited by changing `welcome.md` file. Demo notebooks can be edited in Jupyter.
22
+
23
+ All files created for demo are in the current directory.
24
+
25
+ ## Demo applications
26
+
27
+