File size: 3,637 Bytes
4096d6d
 
 
 
 
 
 
 
 
 
b66e25a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9010db6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b66e25a
 
9010db6
 
 
 
 
 
 
 
 
 
b66e25a
9010db6
b66e25a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9010db6
b66e25a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import streamlit as st


st.set_page_config(
    page_title="Hello",
    page_icon="👋",
)

st.sidebar.success("Select a Page")

st.title('Getting Setup for Streamlit Spaces')

st.markdown("""
## Step 1: Install what you need for this notebook

It is recommended you install into a conda environment:

```
conda create -n DataVizClass python=3.10
conda activate DataVizClass
```

Then you can install the correct packages.  

```
pip install streamlit==1.39.0 altair numpy pandas matplotlib
```

To work with the VSCode interface, be sure that `jupyter` is also installed:

```
pip install jupyter
```
 
Or you can install with `conda`.

Note that the package [Streamlit](https://streamlit.io/) that we will be working with requires we use Python scripts, so JupyterLab and/or Jupyter Notebooks won't work for this process. """)

st.markdown("""
## Step 2: Clone the App files -- Option 1 (HuggingFace)
            
If you want to be able to deploy this app on HuggingFace, there are some extra steps required for setup (or skip to Option 2 for locally running things).
            
### Step 2.1: Set up a token to use with HuggingFace

Next you will create an [access token for your HuggingFace account](https://huggingface.co/docs/hub/en/security-tokens). 

**Step 2.1.1:** Navigate to the "Access Tokens" page from "Settings" under your username:
""")

st.image("images/accesskey_p1.png")

st.markdown(""" 
**Step 2.1.2:** Create a new finegrained token with read/write access to your personal repositories.

First, click on the "Create new token" button on this page.  

Then select a Finegrained token with read/write access to your personal repos:
""")

st.image("images/accesskey_p2.png")

st.markdown("""
**Step 2.1.3:** Generate the Token and *save it somewhere safe* 
1. Click on `Create Token` at the bottom of the current page
2. *Save the token string somewhere safe!* We will be using this token throughout this class.
""")



st.markdown("""
### Step 2.2: Duplicate the HuggingFace App
 """)

st.markdown("""
If you want to be able to deploy your own app on your own HuggingFace account, 
you first need to duplicate this space.            

To duplicate, right click on the 3 dots to the left of your profile icon: """)

st.image("images/duplicateSpace_p1.png")

st.markdown("""
Make sure your user name is selected, and it is set to `Public` for visibility.  Name the space whatever you want:
 """)

st.image("images/duplicateSpace_p2.png")

st.markdown("""
### Step 2.3: Clone *your duplicated* Space
 """)

st.markdown("""
First, be sure that `git-lfs` is installed, and then clone *your* duplicated space repo.
            
You can find instructions for this by once again right-clicking the 3 dots and clicking on "Clone Repository":
 """)

st.image("images/clone_the_repo.png")

st.markdown("""
Then you will be given this set of instructions (note your repo name will be different!):
 """)

st.image("images/gitclone_hf.png")

st.markdown("""
 """)

st.markdown("""
Now you should have a repository folder on your local computer that has your repo name and the files for this app.
 """)

st.markdown("""
## Step 2: Clone the App files -- Option 2 (GitHub)
""")

st.markdown("""
If you don't want to mess around with HuggingFace and just want to play around with Streamlit locally, 
you can also download these files from GitHub by [cloning this repository right here](https://github.com/jnaiman/shadisClassApp).
            
For info about using git commands to clone a repository, [see this link right here](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository).
 """)