Skip to content

Commit

Permalink
image is now 100% width?
Browse files Browse the repository at this point in the history
  • Loading branch information
ephes committed Oct 29, 2023
1 parent a24e8fa commit c20c392
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 27 deletions.
27 changes: 18 additions & 9 deletions numpy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,15 @@
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"879 µs ± 38.6 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)\n"
]
}
],
"source": [
"long_array = np.arange(n)\n",
"%timeit np.sqrt(long_array)"
Expand All @@ -595,7 +603,15 @@
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"UsageError: Line magic function `%%timeit` not found.\n"
]
}
],
"source": [
"#|notest\n",
"%%timeit \n",
Expand Down Expand Up @@ -637,13 +653,6 @@
"#|notest\n",
"%timeit np.sum(np.mod(a, x) == 0)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
34 changes: 16 additions & 18 deletions text_classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -361,36 +361,34 @@
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Number of samples/number of words per sample ratio: 121\n"
]
},
{
"data": {
"text/html": [
"<img src=\"https://developers.google.com/machine-learning/guides/text-classification/images/TextClassificationFlowchart.png\"/>"
"\n",
"<div>\n",
" <p>Number of samples/number of words per sample ratio: 121</p>\n",
" <img src=\"https://developers.google.com/machine-learning/guides/text-classification/images/TextClassificationFlowchart.png\" style=\"width: 100%\">\n",
"</div>\n"
],
"text/plain": [
"<IPython.core.display.Image object>"
"<IPython.core.display.HTML object>"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
"output_type": "display_data"
}
],
"source": [
"#|notest\n",
"from IPython.display import Image\n",
"from IPython.core.display import HTML\n",
"print(\"Number of samples/number of words per sample ratio: \", samples_to_words_per_sample_ratio)\n",
"Image(url=(\n",
" \"https://developers.google.com/machine-learning/guides/\"\n",
" \"text-classification/images/TextClassificationFlowchart.png\"\n",
"))"
"from IPython.display import display, HTML\n",
"url = \"https://developers.google.com/machine-learning/guides/text-classification/images/TextClassificationFlowchart.png\"\n",
"html_code = f\"\"\"\n",
"<div>\n",
" <p>Number of samples/number of words per sample ratio: {samples_to_words_per_sample_ratio}</p>\n",
" <img src=\"{url}\" style=\"width: 100%\">\n",
"</div>\n",
"\"\"\"\n",
"display(HTML(html_code))"
]
}
],
Expand Down

0 comments on commit c20c392

Please sign in to comment.