Skip to content

Commit

Permalink
some alignments
Browse files Browse the repository at this point in the history
  • Loading branch information
KissPeter committed Jul 13, 2023
1 parent 7dba5d2 commit 6e45602
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 17 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/build_dockers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,38 @@ jobs:
uses: actions/checkout@v3
- uses: jpribyl/[email protected]
continue-on-error: true

- name: 'Docker Compose'
uses: isbang/[email protected]
with:
compose-file: "./docker-compose.yml"
up-flags: "--build --force-recreate"
- name: Save text_summary
if: success()
uses: ishworkh/docker-image-artifact-upload@v1
with:
image: "text_summary:latest"
retention_days: "30"
- name: Save sentiment score
if: success()
uses: ishworkh/docker-image-artifact-upload@v1
with:
image: "sentiment_score:latest"
retention_days: "30"

- name: Prepare logs folder
run: |
mkdir ./logs
docker stats --no-stream
- name: Collect docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2
with:
dest: './logs'
- name: Tar logs
if: failure()
run: tar cvzf ./logs.tgz ./logs
- name: Upload logs to GitHub
if: failure()
uses: actions/upload-artifact@master
with:
name: logs.tgz
path: ./logs.tgz
path: ./logs.tgz

- name: Save text_summary
if: success()
uses: ishworkh/docker-image-artifact-upload@v1
with:
image: "text_summary:latest"
retention_days: "30"
- name: Save sentiment score
if: success()
uses: ishworkh/docker-image-artifact-upload@v1
with:
image: "sentiment_score:latest"
retention_days: "30"
2 changes: 1 addition & 1 deletion Dockerfile_download_model_data
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11.3-slim-buster
FROM python:3.10.8-slim-buster
ENV PIP_NO_CACHE_DIR=yes
RUN pip install --upgrade pip
WORKDIR /src/
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ https://github.com/dmmiller612/bert-extractive-summarizer/network/dependents
# Seems like there are 2 pillars of a good summarizer:
1. Coreference technique: identify and substitute the subject of the sentences accurately
2. Extractive Summarization: ability to cope with long tokens

# Configuration
You can configure the FastAPI framework with WORKERS and THREADS env variable - used by gconf.py
30 changes: 30 additions & 0 deletions api_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import urllib3

http_client = urllib3.PoolManager(
retries=urllib3.Retry(
connect=5,
read=2,
redirect=5,
status_forcelist=[429, 500, 501, 502, 503, 504],
backoff_factor=0.2,
),
timeout=urllib3.Timeout(connect=5.0, read=120.0),
num_pools=10,
)

def summarize(text):
_min = min(max(int(len(text)/100*8), 10), 200)
_max = min(max(int(len(text)/100*12), 50), 400)
if _min > _max:
_min, _max = _max, _min
fields= {
'min_length': _min,
'max_length': _max,
'text': text
}
print(f"{_min} - {_max}")
_request = http_client.request(method='POST', url='http://localhost:8002/v1/summarize/', fields=fields)
print(f"{text} summary generation {_request.status} finished in {_request.headers.get('x-process-time')} seconds, summary:")
return _request.data.decode("utf-8")

print(summarize('This is the text to summarize'))
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ services:
nofile:
soft: 65536
hard: 65536
volumes:
- "./text_summary/model:/src/summarization"

sentiment_score:
depends_on:
Expand All @@ -62,4 +64,6 @@ services:
nofile:
soft: 65536
hard: 65536
volumes:
- "./sentiment_scoring/model:/src/sentiment_scoring"

Empty file.
Empty file added text_summary/model/placeholder
Empty file.

0 comments on commit 6e45602

Please sign in to comment.