David Kagramanyan commited on
Commit
4cd5c1e
·
1 Parent(s): 8da6c15

updated examples

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -8,11 +8,12 @@ from spacy import displacy
8
  os.system("python -m spacy download en_core_web_md")
9
  import spacy
10
 
11
-
 
12
 
13
  options = {"ents": ["Observation",
14
  "Evaluation"],
15
- "colors" : {
16
  "Observation": "#9bddff",
17
  "Evaluation": "#f08080",
18
  }
@@ -71,7 +72,6 @@ def set_entities(sentence, entities):
71
 
72
 
73
  def apply_ner(input_text_message: str):
74
-
75
  endpoint_url = 'https://on1m82uknekghqeh.us-east-1.aws.endpoints.huggingface.cloud'
76
 
77
  headers = {
@@ -92,11 +92,14 @@ def apply_ner(input_text_message: str):
92
  return displacy_html
93
 
94
 
95
- examples = ['You are dick','Today i broke my leg and my dad is a dick',
96
- 'My dad is an asshole and took his anger out on my mom by verbally abusing her',
97
- 'He eventually moved on to my brother']
 
 
 
98
 
99
  iface = gr.Interface(fn=apply_ner, inputs=gr.inputs.Textbox(lines=5, placeholder="Enter your text here",
100
- label='Check your text for compliance with the NVC rules'),
101
  outputs="html", examples=examples)
102
  iface.launch()
 
8
  os.system("python -m spacy download en_core_web_md")
9
  import spacy
10
 
11
+ # entities group method
12
+ # https://huggingface.co/spaces/crabz/sk-ner/blob/main/app.py
13
 
14
  options = {"ents": ["Observation",
15
  "Evaluation"],
16
+ "colors": {
17
  "Observation": "#9bddff",
18
  "Evaluation": "#f08080",
19
  }
 
72
 
73
 
74
  def apply_ner(input_text_message: str):
 
75
  endpoint_url = 'https://on1m82uknekghqeh.us-east-1.aws.endpoints.huggingface.cloud'
76
 
77
  headers = {
 
92
  return displacy_html
93
 
94
 
95
+ examples = ['Things are complicated because we still live together but we have separate lives',
96
+ 'My dad is an asshole and took his anger out on my mom by verbally abusing her and when she left he eventually moved on to my brother',
97
+ 'A two months ago, she was chatting with some random guy',
98
+ 'Not I have a horrid relationship with my brother we’ve never gotten along and probably never will',
99
+ 'I was outside trying to leave and he caught me to explain why Im so rude',
100
+ ]
101
 
102
  iface = gr.Interface(fn=apply_ner, inputs=gr.inputs.Textbox(lines=5, placeholder="Enter your text here",
103
+ label='Check your text for compliance with the NVC rules'),
104
  outputs="html", examples=examples)
105
  iface.launch()