Spaces:
Running
Running
LL-MWA-4o
#8
by
SitonmyFACEBOOK
- opened
README.md
CHANGED
|
@@ -8,17 +8,14 @@ pinned: false
|
|
| 8 |
---
|
| 9 |
|
| 10 |
|
| 11 |
-
<div
|
| 12 |
-
<span style="font-weight: 600;">Spaces Dev Mode is currently in beta.</span> It's available for <a target="_blank"
|
| 13 |
</div>
|
| 14 |
|
| 15 |
-
<div
|
| 16 |
-
<span style="font-weight: 600;">Please share your feedback about Spaces Dev Mode</span> in the <a target="_blank"
|
| 17 |
</div>
|
| 18 |
|
| 19 |
-
<img src="https://cdn-uploads.huggingface.co/production/uploads/61fd75b93c49561870461907/mLiaon921hu6TMHahf_ty.png" style="width: 100%; max-width:950px"/>
|
| 20 |
-
|
| 21 |
-
|
| 22 |
# Spaces Dev Mode (feature preview)
|
| 23 |
|
| 24 |
## About Spaces
|
|
@@ -60,10 +57,10 @@ The application does not restart automatically when you change the code. For you
|
|
| 60 |
### Persisting changes
|
| 61 |
|
| 62 |
<div class="alert alert-warning">
|
| 63 |
-
The changes you make when Dev Mode is enabled are not persisted to the Space repo automatically.
|
| 64 |
-
By default, they will be discarded when Dev Mode is disabled or when the Space goes to sleep.
|
| 65 |
</div>
|
| 66 |
-
If you wish to persist changes made while Dev Mode is enabled, you need to use `git` from inside the Space container (using VS Code or SSH). For example:
|
| 67 |
|
| 68 |
```shell
|
| 69 |
# Add changes and commit them
|
|
@@ -79,7 +76,7 @@ The modal will display a warning if you have uncommitted or unpushed changes in
|
|
| 79 |
|
| 80 |

|
| 81 |
|
| 82 |
-
### How to enable Dev Mode
|
| 83 |
|
| 84 |
Go to your Space's settings and click on "Enable Dev Mode".
|
| 85 |
|
|
@@ -87,7 +84,7 @@ Go to your Space's settings and click on "Enable Dev Mode".
|
|
| 87 |

|
| 88 |
|
| 89 |
|
| 90 |
-
You can also enable Dev Mode from the quick actions dropdown.
|
| 91 |
|
| 92 |
|
| 93 |

|
|
@@ -95,11 +92,11 @@ You can also enable Dev Mode from the quick actions dropdown.
|
|
| 95 |
|
| 96 |
## Limitations
|
| 97 |
|
| 98 |
-
Dev Mode is currently not available for static Spaces. Docker Spaces also have some additional requirements.
|
| 99 |
|
| 100 |
### Docker Spaces
|
| 101 |
|
| 102 |
-
Dev Mode is supported for Docker Spaces. However, your Space needs to comply with the following rules for Dev Mode to work properly.
|
| 103 |
|
| 104 |
1. The following packages must be installed:
|
| 105 |
|
|
@@ -113,11 +110,11 @@ Dev Mode is supported for Docker Spaces. However, your Space needs to comply wit
|
|
| 113 |
|
| 114 |
4. The Dockerfile must contain a `CMD` instruction for startup. Checkout [Docker's documentation](https://docs.docker.com/reference/dockerfile/#cmd) about the `CMD` instruction for more details.
|
| 115 |
|
| 116 |
-
Dev Mode works well when the base image is debian-based (eg, ubuntu).
|
| 117 |
|
| 118 |
-
More exotic linux distros (eg, alpine) are not tested and Dev Mode is not guaranteed to work on them.
|
| 119 |
|
| 120 |
-
### Example of compatible
|
| 121 |
|
| 122 |
This is an example of a Dockerfile compatible with Spaces Dev Mode.
|
| 123 |
|
|
@@ -127,7 +124,7 @@ It then starts a NodeJS application from `/app`.
|
|
| 127 |
```Dockerfile
|
| 128 |
FROM node:19-slim
|
| 129 |
|
| 130 |
-
RUN apt-get update && \
|
| 131 |
apt-get install -y \
|
| 132 |
bash \
|
| 133 |
git git-lfs \
|
|
@@ -135,20 +132,9 @@ RUN apt-get update && \
|
|
| 135 |
htop vim nano && \
|
| 136 |
rm -rf /var/lib/apt/lists/*
|
| 137 |
|
| 138 |
-
|
| 139 |
WORKDIR /app
|
| 140 |
-
COPY --link ./ /app
|
| 141 |
-
RUN npm
|
| 142 |
|
| 143 |
-
|
| 144 |
-
USER 1000
|
| 145 |
-
CMD ["node", "index.js"]
|
| 146 |
```
|
| 147 |
-
|
| 148 |
-
There are several examples of Dev Mode compatible Docker Spaces in this organization.
|
| 149 |
-
Feel free to duplicate them in your namespace!
|
| 150 |
-
|
| 151 |
-
Example Python app (FastAPI HTTP server): https://huggingface.co/spaces/dev-mode-explorers/dev-mode-python
|
| 152 |
-
|
| 153 |
-
Example Javascript app (Express.js HTTP server): https://huggingface.co/spaces/dev-mode-explorers/dev-mode-javascript
|
| 154 |
-
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
|
| 11 |
+
<div style="background-color: rgba(255, 255, 255, 0.5); color: rgba(0, 0, 0, 0.87); border: 1px solid rgba(0, 0, 0, 0.5); border-radius: 8px; padding: 0.5rem 1rem;">
|
| 12 |
+
<span style="font-weight: 600;">Spaces Dev Mode is currently in beta.</span> It's available for <a target="_blank" href="https://huggingface.co/subscribe/pro" style="color: inherit;">PRO</a> users (personnal Spaces) or <a target="_blank" href="https://huggingface.co/enterprise" style="color: inherit;">Enterprise</a> organizations (org Spaces).
|
| 13 |
</div>
|
| 14 |
|
| 15 |
+
<div style="background-color: rgba(255, 255, 255, 0.5); color: rgba(0, 0, 0, 0.87); border: 1px solid rgba(0, 0, 0, 0.5); border-radius: 8px; padding: 0.5rem 1rem; margin-top: 10px; margin-bottom: 30px;">
|
| 16 |
+
<span style="font-weight: 600;">Please share your feedback about Spaces Dev Mode</span> in the <a target="_blank" href="https://huggingface.co/spaces/dev-mode-explorers/README/discussions" style="color: inherit;">Community tab</a>.
|
| 17 |
</div>
|
| 18 |
|
|
|
|
|
|
|
|
|
|
| 19 |
# Spaces Dev Mode (feature preview)
|
| 20 |
|
| 21 |
## About Spaces
|
|
|
|
| 57 |
### Persisting changes
|
| 58 |
|
| 59 |
<div class="alert alert-warning">
|
| 60 |
+
The changes you make when the Dev Mode is enabled are not persisted to the Space repo automatically.
|
| 61 |
+
By default, they will be discarded when the Dev Mode is disabled or when the Space goes to sleep.
|
| 62 |
</div>
|
| 63 |
+
If you wish to persist changes made while the Dev Mode is enabled, you need to use `git` from inside the Space container (using VS Code or SSH). For example:
|
| 64 |
|
| 65 |
```shell
|
| 66 |
# Add changes and commit them
|
|
|
|
| 76 |
|
| 77 |

|
| 78 |
|
| 79 |
+
### How to enable the Dev Mode
|
| 80 |
|
| 81 |
Go to your Space's settings and click on "Enable Dev Mode".
|
| 82 |
|
|
|
|
| 84 |

|
| 85 |
|
| 86 |
|
| 87 |
+
You can also enable the Dev Mode from the quick actions dropdown.
|
| 88 |
|
| 89 |
|
| 90 |

|
|
|
|
| 92 |
|
| 93 |
## Limitations
|
| 94 |
|
| 95 |
+
The Dev Mode is currently not available for static Spaces. Docker Spaces also have some additional requirements.
|
| 96 |
|
| 97 |
### Docker Spaces
|
| 98 |
|
| 99 |
+
Dev Mode is supported for Docker Spaces. However, your Space needs to comply with the following rules for the Dev Mode to work properly.
|
| 100 |
|
| 101 |
1. The following packages must be installed:
|
| 102 |
|
|
|
|
| 110 |
|
| 111 |
4. The Dockerfile must contain a `CMD` instruction for startup. Checkout [Docker's documentation](https://docs.docker.com/reference/dockerfile/#cmd) about the `CMD` instruction for more details.
|
| 112 |
|
| 113 |
+
The Dev Mode works well when the base image is debian-based (eg, ubuntu).
|
| 114 |
|
| 115 |
+
More exotic linux distros (eg, alpine) are not tested and the Dev Mode is not guaranteed to work on them.
|
| 116 |
|
| 117 |
+
### Example of a compatible Dockerfile
|
| 118 |
|
| 119 |
This is an example of a Dockerfile compatible with Spaces Dev Mode.
|
| 120 |
|
|
|
|
| 124 |
```Dockerfile
|
| 125 |
FROM node:19-slim
|
| 126 |
|
| 127 |
+
RUN RUN apt-get update && \
|
| 128 |
apt-get install -y \
|
| 129 |
bash \
|
| 130 |
git git-lfs \
|
|
|
|
| 132 |
htop vim nano && \
|
| 133 |
rm -rf /var/lib/apt/lists/*
|
| 134 |
|
|
|
|
| 135 |
WORKDIR /app
|
| 136 |
+
COPY --link --chown=1000 ./ /app
|
| 137 |
+
RUN npm ci
|
| 138 |
|
| 139 |
+
CMD ["node", "index.mjs"]
|
|
|
|
|
|
|
| 140 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|