Spaces:
Build error
Build error
Create new file
Browse files
app.py
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from datasets import load_dataset
|
3 |
+
from spacy_streamlit import visualize_textcat, visualize_ner
|
4 |
+
import spacy_streamlit
|
5 |
+
|
6 |
+
|
7 |
+
import pandas as pd
|
8 |
+
from io import StringIO
|
9 |
+
from transformers import pipeline
|
10 |
+
import spacy
|
11 |
+
from PIL import Image
|
12 |
+
|
13 |
+
# we write text
|
14 |
+
st.title('Skills Extraction Project')
|
15 |
+
|
16 |
+
# we write markdown
|
17 |
+
st.markdown('This NLP project helps you extract skills from job description. You just need to paste a job description and directly access the required skills for a specific vacancy. Save time!', unsafe_allow_html=False)
|
18 |
+
|
19 |
+
@st.cache(allow_output_mutation=True)
|
20 |
+
def get_model():
|
21 |
+
return spacy.load("en_core_web_sm")
|
22 |
+
|
23 |
+
nlp = get_model()
|
24 |
+
|
25 |
+
raw_text = st.text_area(label="Insert your job description")
|
26 |
+
|
27 |
+
#if raw_text != "":
|
28 |
+
docx = nlp(raw_text)
|
29 |
+
spacy_streamlit.visualize_ner(docx, labels = nlp.get_pipe('ner').labels)
|
30 |
+
#spacy_streamlit.visualize_ner(docx,labels=nlp.get_pipe('ner').labels)
|
31 |
+
|
32 |
+
|
33 |
+
#download the skills & job description in a csv from a df
|
34 |
+
#@st.cache
|
35 |
+
#def convert_df(df):
|
36 |
+
# IMPORTANT: Cache the conversion to prevent computation on every rerun
|
37 |
+
#return df.to_csv().encode('utf-8')
|
38 |
+
|
39 |
+
#csv = convert_df(my_large_df)
|
40 |
+
|
41 |
+
#st.download_button(
|
42 |
+
#label="Download as as CSV",
|
43 |
+
#data=csv,
|
44 |
+
#file_name='skills.csv',
|
45 |
+
#mime='text/csv',
|
46 |
+
#)
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
@st.cache # 👈 This function will be cached
|
53 |
+
def load_large_dataset():
|
54 |
+
# Do something really slow in here!
|
55 |
+
return load_dataset("glue", "sst2", split="validation")
|