aliabd HF Staff commited on
Commit
6d16c3b
·
1 Parent(s): 97d0575

Upload with huggingface_hub

Browse files
Files changed (3) hide show
  1. DESCRIPTION.md +1 -0
  2. README.md +1 -1
  3. app.py +0 -7
DESCRIPTION.md ADDED
@@ -0,0 +1 @@
 
 
1
+ This simple demo takes advantage of Gradio's HighlightedText, JSON and HTML outputs to create a clear NER segmentation.
README.md CHANGED
@@ -1,7 +1,7 @@
1
 
2
  ---
3
  title: text_analysis
4
- emoji: 🤗
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
 
1
 
2
  ---
3
  title: text_analysis
4
+ emoji: 🔥
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
app.py CHANGED
@@ -1,16 +1,11 @@
1
- # URL: https://huggingface.co/spaces/gradio/text_analysis
2
- # DESCRIPTION: This simple demo takes advantage of Gradio's HighlightedText, JSON and HTML outputs to create a clear NER segmentation.
3
- # imports
4
  import gradio as gr
5
  import os
6
  os.system('python -m spacy download en_core_web_sm')
7
  import spacy
8
  from spacy import displacy
9
 
10
- # load the model
11
  nlp = spacy.load("en_core_web_sm")
12
 
13
- # define the core function
14
  def text_analysis(text):
15
  doc = nlp(text)
16
  html = displacy.render(doc, style="dep", page=True)
@@ -30,7 +25,6 @@ def text_analysis(text):
30
 
31
  return pos_tokens, pos_count, html
32
 
33
- # define the interface, with a textbox input, and three outputs: HighlightedText, JSON, and HTML
34
  demo = gr.Interface(
35
  text_analysis,
36
  gr.Textbox(placeholder="Enter sentence here..."),
@@ -41,5 +35,4 @@ demo = gr.Interface(
41
  ],
42
  )
43
 
44
- # launch
45
  demo.launch()
 
 
 
 
1
  import gradio as gr
2
  import os
3
  os.system('python -m spacy download en_core_web_sm')
4
  import spacy
5
  from spacy import displacy
6
 
 
7
  nlp = spacy.load("en_core_web_sm")
8
 
 
9
  def text_analysis(text):
10
  doc = nlp(text)
11
  html = displacy.render(doc, style="dep", page=True)
 
25
 
26
  return pos_tokens, pos_count, html
27
 
 
28
  demo = gr.Interface(
29
  text_analysis,
30
  gr.Textbox(placeholder="Enter sentence here..."),
 
35
  ],
36
  )
37
 
 
38
  demo.launch()