File size: 1,255 Bytes
d563a73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Demo
emoji: 📉
colorFrom: gray
colorTo: green
sdk: streamlit
sdk_version: 1.10.0
app_file: app.py
pinned: false
license: apache-2.0
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference


# quick start

1. install requirements with `pip install -r requirements`
2. create a .env file in the root directory and add the following variables:
   `REDDIT_API_CLIENT_ID` : the client ID of your reddit app
   `REDDIT_API_CLIENT_SECRET`: the client secret of your reddit app
   follow this tutorial to generate them. <https://www.jcchouinard.com/get-reddit-api-credentials-with-praw/>

3. run the streamlit app using :  `streamlit run app.py`

# scraping

the app use praw library to scrape submissions from reddit. A class named `scraper.RedditScraper` implements and abstracts that feature.

# sentiment analysis model
The model used in the application is a fine-tuned BERT-based model trained with labeled data scraped from TSLA subbreddit using a script that uses the scraping module `scraper.RedditScraper`.

The data is available in <https://huggingface.co/datasets/fourthbrain-demo/reddit-comments-demo> , availalbe in 2 versions (used later with DVC), and splitted into train/test datasets.