Solab commited on
Commit
001e4d7
1 Parent(s): 58e5bb3

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +1 -12
  2. app.py +21 -0
  3. requirements.txt +2 -0
README.md CHANGED
@@ -1,12 +1 @@
1
- ---
2
- title: Testi
3
- emoji: 🚀
4
- colorFrom: gray
5
- colorTo: blue
6
- sdk: streamlit
7
- sdk_version: 1.21.0
8
- app_file: app.py
9
- pinned: false
10
- ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+ # bias_02
 
 
 
 
 
 
 
 
 
 
 
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st # web app
2
+ import spacy # named entity recognition
3
+
4
+ st.title("News Bias Words Recognizer")
5
+
6
+ # wait until the modl loads with a simple spinner - progress bar
7
+ with st.spinner("Please wait while the model is eing loaded...."):
8
+ nlp = spacy.load("en_pipeline")
9
+
10
+ ## text box to get user input
11
+
12
+ input = st.text_area(label = "Enter your text to get biased words recognized .......")
13
+
14
+ # create a doc object
15
+ doc = nlp(input)
16
+
17
+ # visualize the output
18
+
19
+ output_html = spacy.displacy.render(doc, style="ent", jupyter=False, options={"colors":{'bias':"#ff5136"}})
20
+
21
+ st.markdown(output_html, unsafe_allow_html=True)
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ spacy
2
+ https://huggingface.co/d4data/en_pipeline/resolve/main/en_pipeline-any-py3-none-any.whl