sbrandeis HF staff commited on
Commit
bab9d52
1 Parent(s): db6eeb9

Update the org card

Browse files

cc

@victor

Files changed (1) hide show
  1. README.md +65 -7
README.md CHANGED
@@ -18,25 +18,79 @@ pinned: false
18
 
19
  # Spaces Dev Mode (feature preview)
20
 
 
21
 
22
- If Dev mode is enabled on your Space, you can connect to it using SSH or VS Code.
23
- You can make changes to your application code, run some debug tools, ...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  <img src="https://cdn-uploads.huggingface.co/production/uploads/5f17f0a0925b9863e28ad517/wSfCELm8WoY_EFhj8l1MM.png" style="max-width: 500px;">
26
 
27
- Changes will be reflected in your space after you hit the refresh button.
28
- When you are done, you can persist your changes using `git' as you would normally do when developing locally.
 
 
 
 
 
 
 
 
29
 
 
30
 
31
- ## How to enable the dev mode
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  Go to your Space's settings and click on "Enable dev mode".
34
 
35
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5fcfb7c407408029ba3577e2/QvLqvKxEzq8v0cpxQQ5An.png)
 
 
 
 
 
 
 
 
36
 
37
  ## Limitations
38
 
39
- The dev mode is currently not available for static Spaces.
40
 
41
  ### Docker Spaces
42
 
@@ -54,6 +108,10 @@ Dev mode is supported for Docker Spaces. However, your Space needs to comply wit
54
 
55
  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.
56
 
 
 
 
 
57
  ### Example of a compatible Dockerfile
58
 
59
  This is an example of a Dockerfile compatible with Spaces dev mode.
 
18
 
19
  # Spaces Dev Mode (feature preview)
20
 
21
+ ## About Spaces
22
 
23
+ Spaces offer a simple way to host ML demos and apps on your profile or your organization's profile.
24
+ In essence, a Space is a Docker container that runs your application.
25
+
26
+ Learn more about Spaces here: <a href="https://huggingface.co/docs/hub/spaces" target="_blank">https://huggingface.co/docs/hub/spaces</a>.
27
+
28
+ ## Spaces dev mode
29
+
30
+
31
+ Whenever your commit some changes to your Space repo, the underlying Docker image gets rebuilt, and then a new virtual machine is provisioned to host the new container.
32
+
33
+ The dev mode allows you to update your Space much quicker by overriding the Docker image.
34
+
35
+ The dev mode Docker image starts your application as a sub-process, allowing you to restart it without stopping the Space container itself.
36
+ It also starts a VS Code server and a SSH server in the background for you to connect to the Space.
37
+
38
+ The ability to connect to the running Space unlocks several use cases:
39
+ - You can make changes to the app code without the Space rebuilding everytime
40
+ - You can debug a running application and monitor resources live
41
+
42
+ Overall it makes developing and experimenting with Spaces much faster by skipping the Docker image rebuild phase.
43
+
44
+ ## Interface
45
+
46
+ Once the dev mode is enabled on your Space, you should see a modal like the following.
47
 
48
  <img src="https://cdn-uploads.huggingface.co/production/uploads/5f17f0a0925b9863e28ad517/wSfCELm8WoY_EFhj8l1MM.png" style="max-width: 500px;">
49
 
50
+ The application does not restart automatically when you change the code. For your changes to appear in the Space, you need to use the `Refresh` button that will restart the app.
51
+
52
+ <div class="alert alert-warning">
53
+ If you're using the Streamlit or Gradio SDK, or if your application is Pyhton-based, note that requirements are not installed automatically.
54
+ You will need to manually run `pip install` from VS Code or SSH.
55
+ </div>
56
+
57
+ ### Persisting changes
58
+
59
+ The changes you make when the dev mode is enabled are not persisted to the Space repo automatically, and by default they will be discarded when the dev mode is disabled or when the Space goes to sleep.
60
 
61
+ 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:
62
 
63
+ ```shell
64
+ # Add changes and commit them
65
+ git add .
66
+ git commit -m "Persist changes from dev mode"
67
+
68
+ # Push the commit to persist them in the repo
69
+ git push
70
+ ```
71
+
72
+ The modal will display a warning if you have uncommitted or unpushed changes in the Space:
73
+
74
+
75
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5fcfb7c407408029ba3577e2/r6Uk1YyvE2-hzsKTSRvnR.png)
76
+
77
+ ### How to enable the dev mode
78
 
79
  Go to your Space's settings and click on "Enable dev mode".
80
 
81
+
82
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5fcfb7c407408029ba3577e2/31fExSYIPyxgXm-B9uL4d.png)
83
+
84
+
85
+ You can also enable the dev mode from the quick actions dropdown.
86
+
87
+
88
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/5fcfb7c407408029ba3577e2/t2nQI_5kXY53QIVqBkIx6.png)
89
+
90
 
91
  ## Limitations
92
 
93
+ The dev mode is currently not available for static Spaces. Docker Spaces also have some additional requirements.
94
 
95
  ### Docker Spaces
96
 
 
108
 
109
  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.
110
 
111
+ The Dev Mode works well when the base image is debian-based (eg, ubuntu).
112
+
113
+ More exotic linux distros (eg, alpine) are not tested and the dev mode is not guaranteed to work on them.
114
+
115
  ### Example of a compatible Dockerfile
116
 
117
  This is an example of a Dockerfile compatible with Spaces dev mode.