a | b/talk/serve.py | ||
---|---|---|---|
1 | import os |
||
2 | import sys |
||
3 | import glob |
||
4 | import numpy as np |
||
5 | from subprocess import call |
||
6 | from IPython.nbconvert.postprocessors import ServePostProcessor |
||
7 | |||
8 | # Grab relevant file |
||
9 | file = glob.glob("%s*.ipynb" % sys.argv[1])[0] |
||
10 | |||
11 | # Generate Reveal.js slides |
||
12 | call(["ipython", "nbconvert", file, "--to", "slides"]) |
||
13 | |||
14 | # Serve |
||
15 | server = ServePostProcessor(port = 8000 + np.random.randint(low=10, high=1000)) |
||
16 | server(file.split(".ipynb")[0] + ".slides.html?theme=serif") |