Skip to content

Commit

Permalink
update the demo (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
12rambau authored Jan 20, 2023
2 parents 51d580c + 4b0175f commit 5c9b741
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 13 deletions.
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ qutree
:target: https://github.com/alice4space/qutree/blob/main/AUTHORS.rst
:alt: All contributors

.. image:: https://img.shields.io/badge/-open%20in%20colab-blue?logo=googlecolab&labelColor=555&logoColor=white
:target: https://colab.research.google.com/github/alice4space/qutree/blob/main/docs/source/examples/demo.ipynb
:alt: colab

.. image:: https://img.shields.io/badge/-open%20in%20mybinder-blue?logo=jupyter&labelColor=555&logoColor=white
:target: https://mybinder.org/v2/gh/alice4space/qutree/main?labpath=docs%2Fsource%2Fexamples%2Fdemo.ipynb
:alt: binder


Overview
--------
Expand Down
43 changes: 30 additions & 13 deletions docs/source/examples/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,31 @@
"# Usage examples "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "af605d99",
"metadata": {
"nbsphinx": "hidden"
},
"outputs": [],
"source": [
"# this cell is hidden in the docs\n",
"# it installs the requirements to run this demo\n",
"!python -m pip install qutree[demo]"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "69100b47",
"metadata": {},
"source": [
"[![github](https://img.shields.io/badge/-see%20sources-white?logo=github&labelColor=555)](https://github.com/alice4space/qutree/blob/main/docs/source/examples/demo.ipynb)\n",
"[![colab](https://img.shields.io/badge/-open%20in%20colab-blue?logo=googlecolab&labelColor=555)](https://colab.research.google.com/github/alice4space/qutree/blob/main/docs/source/examples/demo.ipynb)\n",
"[![colab](https://img.shields.io/badge/-open%20in%20mybinder-orange?logo=jupyter&labelColor=555)](https://mybinder.org/v2/gh/alice4space/qutree/main?labpath=docs%2Fsource%2Fexamples%2Fdemo.ipynb)"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -157,18 +182,10 @@
"outputs": [],
"source": [
"# read the file from data folder in github\n",
"# mask until the repo is public\n",
"#with tempfile.NamedTemporaryFile() as tmp:\n",
"# url = 'https://raw.githubusercontent.com/alice4space/qutree/main/examples/data/iris_quantum_kernel.npy'\n",
"# urlretrieve(url, tmp.name)\n",
"# states_ml = np.load(tmp.name,allow_pickle=True)\n",
"\n",
"# safe from Alice local files\n",
"# it's hacky and should be removed as soon as the lib goes public \n",
"from pathlib import Path \n",
"\n",
"file = Path(\"\").parent/\"data\"/\"iris_quantum_kernel.npy\"\n",
"states_ml = np.load(file)"
"with tempfile.NamedTemporaryFile() as tmp:\n",
" url = 'https://raw.githubusercontent.com/alice4space/qutree/main/docs/source/examples/data/iris_quantum_kernel.npy'\n",
" urlretrieve(url, tmp.name)\n",
" states_ml = np.load(tmp.name,allow_pickle=True)"
]
},
{
Expand Down Expand Up @@ -299,7 +316,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3 (default, Oct 14 2020, 12:53:46) \n[Clang 11.0.3 (clang-1103.0.32.29)]"
"version": "3.8.3"
},
"vscode": {
"interpreter": {
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ doc = [
"ipython",
"pennylane",
]
demo = [
"ipython",
"pennylane",
]

[tool.setuptools]
include-package-data = true
Expand Down

0 comments on commit 5c9b741

Please sign in to comment.