Skip to content

Commit

Permalink
Merge pull request #1 from linto-ai/bugfix/empty_sentence
Browse files Browse the repository at this point in the history
Fix corner case of empty sequence
  • Loading branch information
Jeronymous authored Apr 26, 2023
2 parents 2971b39 + def5330 commit ba08000
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
5 changes: 4 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.1.1
- Fix error on empty sentences

# 1.1.0
- Added service registration
- Updated README
Expand All @@ -11,4 +14,4 @@

# 1.0.0
- Punctuation service.
- HTTP or Celery serving.
- HTTP or Celery serving.
4 changes: 3 additions & 1 deletion celery_app/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ def punctuation_task(self, text: Union[str, list]):
else:
print("Failed to predict punctuation on sentence: >{sentence}<")
punctuated_sentence = sentence
punctuated_sentence = punctuated_sentence[0].upper() + punctuated_sentence[1:]
# First letter in capital
if len(punctuated_sentence):
punctuated_sentence = punctuated_sentence[0].upper() + punctuated_sentence[1:]
punctuated_sentences.append(punctuated_sentence)

return (
Expand Down
7 changes: 4 additions & 3 deletions http_server/ingress.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ def punctuate():
if result.status_code == 200:
punctuated_sentence = result.text
# First letter in capital
punctuated_sentence = (
punctuated_sentence[0].upper() + punctuated_sentence[1:]
)
if len(punctuated_sentence):
punctuated_sentence = (
punctuated_sentence[0].upper() + punctuated_sentence[1:]
)
punctuated_sentences.append(punctuated_sentence)
else:
raise Exception(result.text)
Expand Down
16 changes: 8 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
captum>=0.3.1
celery[redis,auth,msgpack]>=4.4.7
pandas>=1.1.5
pandas==1.5.1
flask>=1.1.2
flask-cors>=3.0.10
flask-swagger-ui>=3.36.0
pyyaml>=5.4.1
gunicorn>=20.1.0
numpy>=1.19.5
sklearn
numpy==1.23.4
scikit-learn==1.1.2
supervisor>=4.2.2
transformers==3.0.2
torch>=1.7.1
torch-model-archiver>=0.3.0
torchserve>=0.3.0
torchtext>=0.8.1
torchvision>=0.8.2
torch==1.12.1
torch-model-archiver==0.6.0
torchserve==0.6.0
torchtext==0.13.1
torchvision==0.13.1
redis

0 comments on commit ba08000

Please sign in to comment.