File size: 843 Bytes
e4bdfb9
 
 
 
 
 
 
e191bb6
 
 
 
 
e4bdfb9
 
 
 
 
 
e191bb6
e4bdfb9
 
 
 
 
 
 
 
 
bf0649b
 
e4bdfb9
 
c2e0593
e191bb6
 
 
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
37
import spacy
import gradio as gr
from spacy import displacy
from pdfminer.high_level import extract_text

nlp = spacy.load("en_cv_info_extr")

colors = {}
for label in nlp.get_pipe('ner').labels:
  colors[label] = "linear-gradient(90deg, #aa9cfc, #fc9ce7)"

options = {"ents": list(nlp.get_pipe('ner').labels), "colors": colors}

def resume_ner(file):
    resume = extract_text(file.name)
    doc = nlp(resume)
    html = displacy.render(doc, style="ent", page=True, options=options)
    html = (
        "<div style='max-width:100%; max-height:500px; overflow:auto'>"
        + html
        + "</div>"
    )
    return html

demo = gr.Interface(
    resume_ner,
    gr.File(file_types=[".pdf"]),
    ["html"],
    title="Resume Parser for Skills, Education, Experience by Farhan Siddiqui",
    description="Upload Resume"
)

demo.launch()