aimlnerd commited on
Commit
17c482d
1 Parent(s): 161c488

update gradio server

Browse files
Files changed (3) hide show
  1. Dockerfile +1 -1
  2. gradio_ner.py +5 -3
  3. requirements.txt +1 -1
Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
  # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
  # you will also find guides on how best to write your Dockerfile
3
-
4
  FROM python:3.11.5
5
 
6
  WORKDIR /code
 
1
  # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
  # you will also find guides on how best to write your Dockerfile
3
+ # https://huggingface.co/spaces/sayakpaul/demo-docker-gradio/blob/main/Dockerfile
4
  FROM python:3.11.5
5
 
6
  WORKDIR /code
gradio_ner.py CHANGED
@@ -1,5 +1,6 @@
1
- from transformers import pipeline
2
  import gradio as gr
 
 
3
 
4
  examples = [
5
  """
@@ -76,6 +77,8 @@ model_checkpoint = "aimlnerd/bert-finetuned-legalentity-ner"
76
  ner_pipeline = pipeline(
77
  "token-classification", model=model_checkpoint, aggregation_strategy="simple"
78
  )
 
 
79
 
80
  def ner(text):
81
  output = ner_pipeline(text)
@@ -86,5 +89,4 @@ demo = gr.Interface(ner,
86
  gr.HighlightedText(),
87
  examples=examples)
88
 
89
- demo.launch(share=True)
90
- print()
 
 
1
  import gradio as gr
2
+ import logging
3
+ from transformers import pipeline
4
 
5
  examples = [
6
  """
 
77
  ner_pipeline = pipeline(
78
  "token-classification", model=model_checkpoint, aggregation_strategy="simple"
79
  )
80
+ logging.info(f"NER pipeline initialized with checkpoint {model_checkpoint}")
81
+
82
 
83
  def ner(text):
84
  output = ner_pipeline(text)
 
89
  gr.HighlightedText(),
90
  examples=examples)
91
 
92
+ demo.launch(server_name="0.0.0.0", server_port=7860)
 
requirements.txt CHANGED
@@ -1,6 +1,6 @@
1
  transformers[torch]==4.36.1
2
  numpy==1.26.3
3
- scikit-learn==1.3.2
4
  matplotlib==3.8.2
5
  datasets==2.16.1
6
  evaluate==0.4.1
 
1
  transformers[torch]==4.36.1
2
  numpy==1.26.3
3
+ #scikit-learn==1.3.2
4
  matplotlib==3.8.2
5
  datasets==2.16.1
6
  evaluate==0.4.1