Spaces:
Sleeping
Sleeping
tappyness1
commited on
Commit
·
eb3d6bf
1
Parent(s):
d1cc84a
additional documentation
Browse files
.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
*.jpg
|
2 |
+
*.csv
|
README.md
CHANGED
@@ -10,3 +10,66 @@ pinned: false
|
|
10 |
---
|
11 |
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
---
|
11 |
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
13 |
+
|
14 |
+
## View the App - https://huggingface.co/spaces/GT6242Causion/Causion
|
15 |
+
|
16 |
+
## To clone the repo -
|
17 |
+
```
|
18 |
+
git clone https://huggingface.co/spaces/GT6242Causion/Causion
|
19 |
+
```
|
20 |
+
|
21 |
+
## To set up your environment to run it locally
|
22 |
+
|
23 |
+
### Important - assumes you have Ana/Miniconda on your machine
|
24 |
+
|
25 |
+
1. After cloning the repo, open your terminal in the folder or open the terminal and navigate to your folder
|
26 |
+
```
|
27 |
+
cd path/to/folder/Causion
|
28 |
+
```
|
29 |
+
2. Use the conda environment management to create your environment
|
30 |
+
|
31 |
+
```
|
32 |
+
conda env create -f env.yml --name Causion
|
33 |
+
```
|
34 |
+
|
35 |
+
3. Activate the Environment
|
36 |
+
```
|
37 |
+
conda activate Causion
|
38 |
+
```
|
39 |
+
|
40 |
+
4. You can now run your streamlit app locally. See Below segment "Running Streamlit App locally" for further details
|
41 |
+
|
42 |
+
## To add, commit and push your development:
|
43 |
+
|
44 |
+
```
|
45 |
+
git add . # this will add all the files you committed but that is probably not what you want to do
|
46 |
+
git commit -m "<your message here>"
|
47 |
+
git push
|
48 |
+
```
|
49 |
+
|
50 |
+
## Running Streamlit App locally
|
51 |
+
|
52 |
+
The usual command for running the steamlit app is as follows:
|
53 |
+
|
54 |
+
1. Open your terminal in the folder or open the terminal and navigate to your folder
|
55 |
+
```
|
56 |
+
cd path/to/folder/Causion
|
57 |
+
```
|
58 |
+
|
59 |
+
2. Run streamlit app
|
60 |
+
```
|
61 |
+
streamlit run app.py
|
62 |
+
```
|
63 |
+
|
64 |
+
However, before running your app, you have to make sure you have the dataset with you.
|
65 |
+
|
66 |
+
There are two ways to make sure of this
|
67 |
+
1. Pull dataset right from HuggingFace Spaces Dataset - always streaming in the new data, but need to add into temp Environment variable every time. This is default because our app has to stream in the data
|
68 |
+
2. Download the dataset and run locally in the data folder - Easier to setup, but always have to download the dataset. Also need to set the data code back to default every time.
|
69 |
+
|
70 |
+
For option #1, you do not need to change anything in the script. You just need to have an additional line to add environment variable in your terminal:
|
71 |
+
|
72 |
+
Powershell:
|
73 |
+
```
|
74 |
+
$env:TOKEN = "<insert TOKEN secret here>"
|
75 |
+
```
|
app.py
CHANGED
@@ -16,11 +16,17 @@ def bar_chart(counts_df):
|
|
16 |
|
17 |
|
18 |
def main():
|
|
|
|
|
19 |
dataset = load_dataset("tappyness1/causion", use_auth_token=os.environ['TOKEN'])
|
20 |
-
print (dataset)
|
21 |
# print (pd.DataFrame(dataset['train']))
|
22 |
counts_df = pd.DataFrame(dataset['train'])
|
|
|
|
|
|
|
23 |
# counts_df = pd.read_csv("data/counts_dataset.csv")
|
|
|
24 |
# st.set_page_config(layout="wide")
|
25 |
height = 650
|
26 |
|
|
|
16 |
|
17 |
|
18 |
def main():
|
19 |
+
|
20 |
+
# comment out for local testing, but be sure to include after testing
|
21 |
dataset = load_dataset("tappyness1/causion", use_auth_token=os.environ['TOKEN'])
|
22 |
+
# print (dataset)
|
23 |
# print (pd.DataFrame(dataset['train']))
|
24 |
counts_df = pd.DataFrame(dataset['train'])
|
25 |
+
|
26 |
+
# only use this part before for local testing
|
27 |
+
# once local testing is completed, comment out and use the dataset above
|
28 |
# counts_df = pd.read_csv("data/counts_dataset.csv")
|
29 |
+
|
30 |
# st.set_page_config(layout="wide")
|
31 |
height = 650
|
32 |
|
env.yml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
dependencies:
|
2 |
+
- python=3.8
|
3 |
+
- pip
|
4 |
+
- pip:
|
5 |
+
- huggingface_hub>= 0.12
|
6 |
+
- datasets>=2.8.0
|
7 |
+
- pandas
|
8 |
+
- plotly
|