Tanor commited on
Commit
57b58d1
1 Parent(s): 75b0e8e

some imrovemnts

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -7,7 +7,11 @@ nlp = spacy.load("sr_Spacy_Serbian_Model_SrpKor4Tagging_BERTICOVO")
7
 
8
  # Define a function to display the tags and lemmas
9
  def display_tags_and_lemmas(text):
10
- doc = nlp(text)
 
 
 
 
11
  html = displacy.render(doc, style="ent", page=True, minify=True)
12
 
13
  # We'll also create a custom HTML to display lemmas nicely
@@ -29,7 +33,8 @@ iface = gr.Interface(
29
  outputs=gr.HTML(label="Leme i POS oznake"),
30
  title="spaCy Tagger i Lemmatizer",
31
  description="Unesite rečenicu da biste videli njene imenovane entitete, POS oznake i leme.",
32
- examples=["Lep je dan, danas. Sutra će biti još lepši!", "Psi su trčali svakog dana. Mačke su spavale."]
 
33
  )
34
 
35
  iface.launch()
 
7
 
8
  # Define a function to display the tags and lemmas
9
  def display_tags_and_lemmas(text):
10
+ # First, we'll use spaCy to tag and parse the text
11
+ text = text.strip()
12
+ if not text:
13
+ return "", ""
14
+ doc = nlp(text.strip())
15
  html = displacy.render(doc, style="ent", page=True, minify=True)
16
 
17
  # We'll also create a custom HTML to display lemmas nicely
 
33
  outputs=gr.HTML(label="Leme i POS oznake"),
34
  title="spaCy Tagger i Lemmatizer",
35
  description="Unesite rečenicu da biste videli njene imenovane entitete, POS oznake i leme.",
36
+ examples=["Lep je dan, danas. Sutra će biti još lepši!", "Psi su trčali svakog dana. Mačke su spavale."],
37
+ allow_screenshot=True
38
  )
39
 
40
  iface.launch()