oroszgy commited on
Commit
2256c91
1 Parent(s): a6d8050

feat: disabled cache and refactored dbpepdia spotlight

Browse files
Files changed (4) hide show
  1. app.py +1 -4
  2. examples/anon.py +1 -1
  3. examples/dbpedia.py +3 -1
  4. examples/relation.py +1 -1
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import gradio as gr
2
 
3
  from examples.anon import demo as anon_demo
4
- from examples.common import NLP
5
  from examples.dbpedia import demo as dbpedia_demo
6
  from examples.keyphrases import demo as keyphrases_demo
7
  from examples.relation import demo as relation_demo
@@ -16,6 +15,4 @@ with demo:
16
  )
17
 
18
  if __name__ == '__main__':
19
- NLP.add_pipe("dbpedia_spotlight", config={'dbpedia_rest_endpoint': 'https://dbpedia-spotlight.dsd.sztaki.hu/hu',
20
- 'overwrite_ents': False})
21
- demo.launch()
 
1
  import gradio as gr
2
 
3
  from examples.anon import demo as anon_demo
 
4
  from examples.dbpedia import demo as dbpedia_demo
5
  from examples.keyphrases import demo as keyphrases_demo
6
  from examples.relation import demo as relation_demo
 
15
  )
16
 
17
  if __name__ == '__main__':
18
+ demo.launch(share=True)
 
 
examples/anon.py CHANGED
@@ -74,5 +74,5 @@ demo = gr.Interface(
74
  outputs=[gr.Textbox(label="Anonymized text", show_label=True),
75
  gr.Textbox(label="Tags", show_label=True)],
76
  examples=EXAMPLES,
77
- # cache_examples=True,
78
  )
 
74
  outputs=[gr.Textbox(label="Anonymized text", show_label=True),
75
  gr.Textbox(label="Tags", show_label=True)],
76
  examples=EXAMPLES,
77
+ cache_examples=False,
78
  )
examples/dbpedia.py CHANGED
@@ -3,6 +3,8 @@ import pandas as pd
3
 
4
  from examples.common import NLP
5
 
 
 
6
 
7
  def process(text: str) -> pd.DataFrame:
8
  doc = NLP(text)
@@ -24,5 +26,5 @@ demo = gr.Interface(
24
  inputs=gr.Textbox(value=EXAMPLES[0], lines=10, label="Input text", show_label=True),
25
  outputs=gr.DataFrame(label="DBpedia Spotlight Annotations", show_label=False, max_cols=2, max_rows=10),
26
  examples=EXAMPLES,
27
- # cache_examples=True,
28
  )
 
3
 
4
  from examples.common import NLP
5
 
6
+ NLP.add_pipe("dbpedia_spotlight", config={'dbpedia_rest_endpoint': 'https://dbpedia-spotlight.dsd.sztaki.hu/hu',
7
+ 'overwrite_ents': False})
8
 
9
  def process(text: str) -> pd.DataFrame:
10
  doc = NLP(text)
 
26
  inputs=gr.Textbox(value=EXAMPLES[0], lines=10, label="Input text", show_label=True),
27
  outputs=gr.DataFrame(label="DBpedia Spotlight Annotations", show_label=False, max_cols=2, max_rows=10),
28
  examples=EXAMPLES,
29
+ cache_examples=False,
30
  )
examples/relation.py CHANGED
@@ -49,5 +49,5 @@ demo = gr.Interface(
49
  inputs=gr.Textbox(value=EXAMPLES[0], lines=10, label="Input text", show_label=True),
50
  outputs=gr.DataFrame(label="Keywords", show_label=False, max_cols=3, max_rows=1),
51
  examples=EXAMPLES,
52
- # cache_examples=True,
53
  )
 
49
  inputs=gr.Textbox(value=EXAMPLES[0], lines=10, label="Input text", show_label=True),
50
  outputs=gr.DataFrame(label="Keywords", show_label=False, max_cols=3, max_rows=1),
51
  examples=EXAMPLES,
52
+ cache_examples=False,
53
  )