Shehab Eldeen Ehab
Shehab Eldeen Ehab

Reputation: 1

How to make Cell input part (code) disappear -show only output- when creating slides using Jupyter notebook and nbconvert?

I am trying to create slides for a data analysis task using jupyter notebook and nbconvert Python module.

I want to show the output of a cell which is the visualization part, and I want to get rid of the code part.

It is created but with the code part in the slide.

I tried a solution from Udacity Data Analysis Nano degree which suggests installing a pre-written template and then running the command:

jupyter nbconvert Example_Project_Diamonds_Part2.ipynb --to slides --post serve --template output_toggle

The template

but I get the error that 'slides_reveal.tpl' template does not exist, and when I try to download it from the internet I keep getting the same error but for different template names (It's like a vortex).

Upvotes: 0

Views: 1051

Answers (2)

tturbo
tturbo

Reputation: 1128

The extended answer:

Hide all inputs (code):
jupyter nbconvert --to slides --no-input my-notebook.ipynb

Hide selected inputs only:

  1. add a cell tag 'output_only'
  2. --TagRemovePreprocessor.remove_input_tags={\"output_only\"}

source

Use an extension:
github.com/kirbs-/hide_code

Bonus: Hide all prompts:
jupyter nbconvert --to slides --no-prompt my-notebook.ipynb

Upvotes: 0

Shehab Eldeen Ehab
Shehab Eldeen Ehab

Reputation: 1

  1. Open the Jupyter notebook Home page.
  2. Choose New (on the top right) then Terminal.
  3. Go to the directory of your .ipynb file.
  4. Type the following command in the prompt:
jupyter nbconvert --to slides <filename>.ipynb --TemplateExporter.exclude_input=True

or you can just type in the jupyter notebook itself:

!jupyter nbconvert --to slides <filename>.ipynb --TemplateExporter.exclude_input=True

Upvotes: 0

Related Questions