devanshsrivastav commited on
Commit
d5c1843
β€’
1 Parent(s): a470790

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +55 -13
README.md CHANGED
@@ -8,7 +8,7 @@ app_file: app.py
8
 
9
  # GoEmotions Dashboard - Analyzing Emotions in Text
10
 
11
- This is a Python script that uses Streamlit, Plotly, and the Hugging Face Inference API to create a web-based dashboard for analyzing emotions in text.
12
 
13
  ## Pre-requisites:
14
 
@@ -21,29 +21,35 @@ GoEmotions/
21
  β”œβ”€β”€ requirements.txt
22
  β”œβ”€β”€ .env
23
  β”œβ”€β”€ README.md
24
- └── assets/
 
25
  ```
26
 
27
- ## Installation
28
 
29
- `Step 1` - Clone this repository to your local machine.
30
 
31
  ```bash
32
  git clone https://github.com/SudhanshuBlaze/GoEmotions.git
33
  ```
34
 
35
- `Step 2` - Install the required packages using pip:
36
 
37
  ```bash
38
- pip install -r requirements.txt
39
  ```
40
 
41
- `Step 3`- Create a free account on the [Hugging Face website](https://huggingface.co/) to get an API key.
 
 
42
 
43
- `Step 4`
44
 
45
- - Create a `.env` file in the root directory of the project and add your
46
- - Hugging Face API key like this: `HF_API_KEY=<your_api_key_here>`
 
 
 
47
 
48
  `Step 5` - Navigate to the root directory of the project.
49
 
@@ -51,21 +57,57 @@ pip install -r requirements.txt
51
  cd GoEmotions
52
  ```
53
 
54
- `Step 6` - Run the Streamlit app.
 
 
 
 
 
55
 
56
  ```bash
57
  streamlit run app.py
58
  ```
59
 
 
 
 
 
 
 
60
  - If you want to run this application on GitHub Codespaces, you will need to add the following flags to the `streamlit run` command:
61
 
62
  ```bash
63
  python -m streamlit run app.py --server.enableCORS false --server.enableXsrfProtection false
64
  ```
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  ## Usage:
67
 
68
  - A web-based dashboard will open in your default browser.
69
  - Type or paste a text input in the text box provided.
70
- - The dashboard will display the detected emotions in a set of gauges, with each gauge representing the intensity of a specific emotion category.
71
- - The gauge colors are based on a predefined color map for each emotion category.
 
8
 
9
  # GoEmotions Dashboard - Analyzing Emotions in Text
10
 
11
+ This is a Python script that uses Streamlit, Plotly, and the Hugging Face Inference API to create a web-based dashboard for analyzing emotions in text. Finally this dashboard is deployed on Hugging Face Spaces using GitHub Actions.
12
 
13
  ## Pre-requisites:
14
 
 
21
  β”œβ”€β”€ requirements.txt
22
  β”œβ”€β”€ .env
23
  β”œβ”€β”€ README.md
24
+ β”œβ”€β”€ assets/
25
+ └── .github/workflows
26
  ```
27
 
28
+ ## Setup
29
 
30
+ `Step 1` - Clone this repository to your local machine using the following command, or open the repository in GitHub Codespaces.
31
 
32
  ```bash
33
  git clone https://github.com/SudhanshuBlaze/GoEmotions.git
34
  ```
35
 
36
+ `Step 2` - Create and activate a new python virtual environment: (This step can be skipped if working on GitHub Codespaces!)
37
 
38
  ```bash
39
+ python -m venv venv
40
  ```
41
 
42
+ ```bash
43
+ venv\Scripts\activate
44
+ ```
45
 
46
+ `Step 3` - Install the required packages using pip: (This step can be skipped if working on GitHub Codespaces as it automatically installs the requirements!)
47
 
48
+ ```bash
49
+ pip install -r requirements.txt
50
+ ```
51
+
52
+ `Step 4`- Create a free account on the [Hugging Face website](https://huggingface.co/) and generate an API key (read).
53
 
54
  `Step 5` - Navigate to the root directory of the project.
55
 
 
57
  cd GoEmotions
58
  ```
59
 
60
+ `Step 6`
61
+
62
+ - Create a `.env` file in the root directory of the project and add your
63
+ - Hugging Face API key like this: `HF_API_KEY=<your_api_key_here>`
64
+
65
+ `Step 7` - Run the Streamlit app.
66
 
67
  ```bash
68
  streamlit run app.py
69
  ```
70
 
71
+ or
72
+
73
+ ```bash
74
+ python -m streamlit run app.py
75
+ ```
76
+
77
  - If you want to run this application on GitHub Codespaces, you will need to add the following flags to the `streamlit run` command:
78
 
79
  ```bash
80
  python -m streamlit run app.py --server.enableCORS false --server.enableXsrfProtection false
81
  ```
82
 
83
+ ## Deployment to Spaces (CI/CD)
84
+
85
+ `Step 1`
86
+ Commit your code and push it to your GitHub repository
87
+
88
+ `Step 2`
89
+ Create a new Space on Hugging Face, add it as an additional remote to git and force push your code on Spaces:
90
+
91
+ ```bash
92
+ git remote add space https://huggingface.co/spaces/HF_USERNAME/SPACE_NAME
93
+ ```
94
+
95
+ ```bash
96
+ git push --force space main
97
+ ```
98
+
99
+ `Step 3`
100
+ In the main.yml, add your Hugging Face username and Space name to the variables 'HF_username' and 'HF_space_name'
101
+
102
+ `Step 4`
103
+ Create a new API key on Hugging Face (write) and add it as a secret to your GitHub Repository naming it as 'HF_TOKEN'.
104
+
105
+ `Step 5`
106
+ Trigger the CI/CD pipeline by a push or a pull request to your main branch.
107
+
108
  ## Usage:
109
 
110
  - A web-based dashboard will open in your default browser.
111
  - Type or paste a text input in the text box provided.
112
+ - The dashboard will visualise the detected emotions in a set of gauges, with each gauge representing the intensity of a specific emotion category. The gauge colors are based on a predefined color map for each emotion category.
113
+ - Moreover, the dashboard will display the results from Hate Speech Analysis and Sexism Detection models.