osanseviero commited on
Commit
5790347
1 Parent(s): 0be042f

Finish draft

Browse files
Files changed (2) hide show
  1. posts/1_blog_in_spaces.md +38 -2
  2. posts/1_token.png +0 -0
posts/1_blog_in_spaces.md CHANGED
@@ -40,7 +40,43 @@ Cool! So Nate has built a [nice template](https://github.com/nateraw/host-a-blog
40
 
41
  Yes, let's do it. First, create a [new Space](https://huggingface.co/new-space) at Hugging Face. You will need to specify the Streamlit SDK. Since it's still being setup, you can make it private so others don't see it. The Space can have any name you want.
42
 
43
- ![Image of Spaces](assets/1_streamlit_space.png)
44
-
45
 
46
  The second step is to create a [write token](https://huggingface.co/settings/token). This will allow GitHub to push whenever there are changes to the Space.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
  Yes, let's do it. First, create a [new Space](https://huggingface.co/new-space) at Hugging Face. You will need to specify the Streamlit SDK. Since it's still being setup, you can make it private so others don't see it. The Space can have any name you want.
42
 
43
+ ![Image of Spaces](https://huggingface.co/spaces/osanseviero/tips-and-tricks/resolve/main/assets/1_streamlit_space.png)
 
44
 
45
  The second step is to create a [write token](https://huggingface.co/settings/token). This will allow GitHub to push whenever there are changes to the Space.
46
+
47
+ ![Creation of write token](https://huggingface.co/spaces/osanseviero/tips-and-tricks/resolve/main/assets/1_token.png)
48
+
49
+ Make sure to copy the token and...
50
+
51
+ **I won't expose my token! They will hack me!**
52
+
53
+ No worries, we'll be adding a **secret** in GitHub, which allows to add environment variables that can be accessed but not viewed by anyone. You can go to your **GitHub repo**, go to Settings -> SECRETS, and click ** New secret**. The name can be `HF_TOKEN` and the value is the one you got from the Hub.
54
+
55
+ Now, if you go to **workflows/sync-to-hub**, you'll see the last line makes a reference to the original repo Space and your token. Let's switch the path to your own Space.
56
+
57
+ So I changed
58
+
59
+ ```
60
+ run: git push https://nateraw:$HF_TOKEN@huggingface.co/spaces/nateraw/host-a-blog-on-huggingface-spaces main --force
61
+ ```
62
+
63
+ to
64
+
65
+ ```
66
+ run: git push https://osanseviero:$HF_TOKEN@huggingface.co/spaces/osanseviero/tips-and-tricks main --force
67
+ ```
68
+
69
+ As you can see, I never exposed my token!
70
+
71
+ **Cool**
72
+
73
+ What is even cooler is that now each time you do any change in the GitHub repository, it will be automatically deployed in HF Spaces and re-deployed!
74
+
75
+ **What's next?**
76
+
77
+ Well, you just finished the setup! There are a couple of places where you will want to change stuff and then write your first article. Once you're ready, you should make your Spaces repo public, share it in social media and get likes from the community!
78
+
79
+ I hope this was useful! Until the next time!
80
+
81
+ A Hacker Llama 🦙
82
+
posts/1_token.png ADDED