devmandan commited on
Commit
0dface2
·
1 Parent(s): da1affc

added new files to have a space

Browse files
Files changed (7) hide show
  1. .dockerignore +6 -0
  2. .github/workflows/update-hf.yml +20 -0
  3. .gitignore +160 -0
  4. Dockerfile +20 -0
  5. environment.yml +18 -0
  6. notebooks/cube.ipynb +133 -0
  7. voila.json +11 -0
.dockerignore ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ .github/
2
+ Dockerfile
3
+ LICENSE
4
+ README.md
5
+ .gitignore
6
+ .dockerignore
.github/workflows/update-hf.yml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Update Hugging Face repository
2
+ on:
3
+ push:
4
+ branches: [main]
5
+
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ push-to-hf:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v3
13
+ with:
14
+ fetch-depth: 0
15
+ lfs: true
16
+ - name: Push to Hugging Face
17
+ env:
18
+ HF_USER: ${{ secrets.HF_USER }}
19
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
20
+ run: git push https://$HF_USER:[email protected]/spaces/devmandan/voila-dashboard-test main --force
.gitignore ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
148
+
149
+ # pytype static type analyzer
150
+ .pytype/
151
+
152
+ # Cython debug symbols
153
+ cython_debug/
154
+
155
+ # PyCharm
156
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
159
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
+ #.idea/
Dockerfile ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM condaforge/mambaforge:latest
2
+
3
+ # The HF Space container runs with user ID 1000.
4
+ RUN useradd -m -u 1000 user
5
+ USER user
6
+
7
+ # Set home to the user's home directory
8
+ ENV HOME=/home/user \
9
+ PATH=/home/user/.local/bin:$PATH
10
+
11
+ # Set the working directory to the user's home directory
12
+ WORKDIR $HOME/app
13
+ COPY --chown=user . .
14
+
15
+ RUN mamba env create --prefix $HOME/env -f ./environment.yml
16
+
17
+ EXPOSE 7860
18
+ WORKDIR $HOME/app
19
+
20
+ CMD mamba run -p $HOME/env --no-capture-output voila --no-browser notebooks/
environment.yml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: voila
2
+ channels:
3
+ - conda-forge
4
+ dependencies:
5
+ - python=3.10
6
+ - ipywidgets
7
+ - ipykernel
8
+ - pandas
9
+ - pip
10
+ - ipympl=0.9.2
11
+ - jupyterlab-fasta
12
+ - ipyvolume
13
+ - pygfx
14
+ - pillow
15
+
16
+ - pip:
17
+ - voila==0.5.0
18
+ - voila-topbar==0.1.1
notebooks/cube.ipynb ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "f4ce92ce",
6
+ "metadata": {},
7
+ "source": [
8
+ "# PyGfx Cube Example"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "code",
13
+ "execution_count": 1,
14
+ "id": "f00886ec",
15
+ "metadata": {},
16
+ "outputs": [
17
+ {
18
+ "name": "stderr",
19
+ "output_type": "stream",
20
+ "text": [
21
+ "WGPU could not load some backends:\n",
22
+ "jupyter: No module named 'jupyter_rfb'\n"
23
+ ]
24
+ },
25
+ {
26
+ "ename": "ImportError",
27
+ "evalue": "WGPU Could not load any of the supported GUI backends.\n You may need to ``pip install -U jupyter_rfb``.",
28
+ "output_type": "error",
29
+ "traceback": [
30
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
31
+ "\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
32
+ "Cell \u001b[0;32mIn[1], line 18\u001b[0m\n\u001b[1;32m 16\u001b[0m disp\u001b[38;5;241m.\u001b[39mbefore_render \u001b[38;5;241m=\u001b[39m animate\n\u001b[1;32m 17\u001b[0m disp\u001b[38;5;241m.\u001b[39mstats \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[0;32m---> 18\u001b[0m \u001b[43mdisp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mshow\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcube\u001b[49m\u001b[43m)\u001b[49m\n",
33
+ "File \u001b[0;32m~/voila-huggingface/venv/lib/python3.11/site-packages/pygfx/utils/show.py:165\u001b[0m, in \u001b[0;36mDisplay.show\u001b[0;34m(self, object, up)\u001b[0m\n\u001b[1;32m 162\u001b[0m \u001b[39m# Process renderer\u001b[39;00m\n\u001b[1;32m 164\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mrenderer \u001b[39mis\u001b[39;00m \u001b[39mNone\u001b[39;00m \u001b[39mand\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mcanvas \u001b[39mis\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[0;32m--> 165\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mwgpu\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mgui\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mauto\u001b[39;00m \u001b[39mimport\u001b[39;00m WgpuCanvas\n\u001b[1;32m 167\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mcanvas \u001b[39m=\u001b[39m WgpuCanvas()\n\u001b[1;32m 168\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mrenderer \u001b[39m=\u001b[39m WgpuRenderer(\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mcanvas)\n",
34
+ "File \u001b[0;32m~/voila-huggingface/venv/lib/python3.11/site-packages/wgpu/gui/auto.py:190\u001b[0m\n\u001b[1;32m 186\u001b[0m \u001b[39myield\u001b[39;00m backend_name, \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m{\u001b[39;00mlibname\u001b[39m}\u001b[39;00m\u001b[39m can be imported\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[1;32m 189\u001b[0m \u001b[39m# Load!\u001b[39;00m\n\u001b[0;32m--> 190\u001b[0m module \u001b[39m=\u001b[39m select_backend()\n\u001b[1;32m 191\u001b[0m WgpuCanvas, run, call_later \u001b[39m=\u001b[39m module\u001b[39m.\u001b[39mWgpuCanvas, module\u001b[39m.\u001b[39mrun, module\u001b[39m.\u001b[39mcall_later\n",
35
+ "File \u001b[0;32m~/voila-huggingface/venv/lib/python3.11/site-packages/wgpu/gui/auto.py:75\u001b[0m, in \u001b[0;36mselect_backend\u001b[0;34m()\u001b[0m\n\u001b[1;32m 71\u001b[0m msg \u001b[39m+\u001b[39m\u001b[39m=\u001b[39m \u001b[39m\"\u001b[39m\u001b[39m\\n\u001b[39;00m\u001b[39m Install glfw using e.g. ``pip install -U glfw``,\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[1;32m 72\u001b[0m msg \u001b[39m+\u001b[39m\u001b[39m=\u001b[39m (\n\u001b[1;32m 73\u001b[0m \u001b[39m\"\u001b[39m\u001b[39m\\n\u001b[39;00m\u001b[39m or install a qt framework using e.g. ``pip install -U pyside6``.\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[1;32m 74\u001b[0m )\n\u001b[0;32m---> 75\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mImportError\u001b[39;00m(msg) \u001b[39mfrom\u001b[39;00m \u001b[39mNone\u001b[39;00m\n",
36
+ "\u001b[0;31mImportError\u001b[0m: WGPU Could not load any of the supported GUI backends.\n You may need to ``pip install -U jupyter_rfb``."
37
+ ]
38
+ }
39
+ ],
40
+ "source": [
41
+ "\n",
42
+ "import pygfx as gfx\n",
43
+ "import pylinalg as la\n",
44
+ "\n",
45
+ "cube = gfx.Mesh(\n",
46
+ " gfx.box_geometry(200, 200, 200),\n",
47
+ " gfx.MeshPhongMaterial(color=\"#336699\"),\n",
48
+ ")\n",
49
+ "\n",
50
+ "\n",
51
+ "def animate():\n",
52
+ " rot = la.quat_from_euler((0.005, 0.01), order=\"XY\")\n",
53
+ " cube.local.rotation = la.quat_mul(rot, cube.local.rotation)\n",
54
+ "\n",
55
+ "\n",
56
+ "disp = gfx.Display()\n",
57
+ "disp.before_render = animate\n",
58
+ "disp.stats = True\n",
59
+ "disp.show(cube)\n"
60
+ ]
61
+ },
62
+ {
63
+ "cell_type": "code",
64
+ "execution_count": null,
65
+ "id": "cc0ca8b1",
66
+ "metadata": {},
67
+ "outputs": [
68
+ {
69
+ "ename": "",
70
+ "evalue": "",
71
+ "output_type": "error",
72
+ "traceback": [
73
+ "\u001b[1;31mJupyter cannot be started. Error attempting to locate Jupyter: Running cells with 'Python 3.11.6 ('venv': venv)' requires jupyter and notebook package.\n",
74
+ "\u001b[1;31mRun the following command to install 'jupyter and notebook' into the Python environment. \n",
75
+ "\u001b[1;31mCommand: 'python -m pip install jupyter notebook -U\n",
76
+ "\u001b[1;31mor\n",
77
+ "\u001b[1;31mconda install jupyter notebook -U'\n",
78
+ "Click <a href='https://aka.ms/installJupyterForVSCode'>here</a> for more info."
79
+ ]
80
+ }
81
+ ],
82
+ "source": []
83
+ },
84
+ {
85
+ "cell_type": "code",
86
+ "execution_count": null,
87
+ "id": "c964ed64",
88
+ "metadata": {},
89
+ "outputs": [
90
+ {
91
+ "ename": "",
92
+ "evalue": "",
93
+ "output_type": "error",
94
+ "traceback": [
95
+ "\u001b[1;31mJupyter cannot be started. Error attempting to locate Jupyter: Running cells with 'Python 3.11.6 ('venv': venv)' requires jupyter and notebook package.\n",
96
+ "\u001b[1;31mRun the following command to install 'jupyter and notebook' into the Python environment. \n",
97
+ "\u001b[1;31mCommand: 'python -m pip install jupyter notebook -U\n",
98
+ "\u001b[1;31mor\n",
99
+ "\u001b[1;31mconda install jupyter notebook -U'\n",
100
+ "Click <a href='https://aka.ms/installJupyterForVSCode'>here</a> for more info."
101
+ ]
102
+ }
103
+ ],
104
+ "source": []
105
+ }
106
+ ],
107
+ "metadata": {
108
+ "kernelspec": {
109
+ "display_name": "Python 3.11.6 ('venv': venv)",
110
+ "language": "python",
111
+ "name": "python3"
112
+ },
113
+ "language_info": {
114
+ "codemirror_mode": {
115
+ "name": "ipython",
116
+ "version": 3
117
+ },
118
+ "file_extension": ".py",
119
+ "mimetype": "text/x-python",
120
+ "name": "python",
121
+ "nbconvert_exporter": "python",
122
+ "pygments_lexer": "ipython3",
123
+ "version": "3.11.6"
124
+ },
125
+ "vscode": {
126
+ "interpreter": {
127
+ "hash": "74b572f558bec4b6e8ae72dcaeb196eb4b5b3785afbb5ff05f58614eacab3cc1"
128
+ }
129
+ }
130
+ },
131
+ "nbformat": 4,
132
+ "nbformat_minor": 5
133
+ }
voila.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "Voila": {
3
+ "ip":"0.0.0.0",
4
+ "port": 7860,
5
+ "tornado_settings": {
6
+ "headers": {
7
+ "Content-Security-Policy": "frame-ancestors self *"
8
+ }
9
+ }
10
+ }
11
+ }