Skip to content

Commit

Permalink
refactor(client): use docarray pbar (#668)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxiao authored and numb3r3 committed May 4, 2022
1 parent 747d6a8 commit 35499b0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 29 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
</p>

<p align=center>
<a href="https://pypi.org/project/clip_server/"><img src="https://github.com/jina-ai/jina/blob/master/.github/badges/python-badge.svg?raw=true" alt="Python 3.7 3.8 3.9 3.10" title="CLIP-as-service supports Python 3.7 and above"></a>
<a href="https://pypi.org/project/clip_server/"><img src="https://img.shields.io/pypi/v/clip_server?color=%23099cec&amp;label=PyPI&amp;logo=pypi&amp;logoColor=white" alt="PyPI"></a>
<a href="https://slack.jina.ai"><img src="https://img.shields.io/badge/Slack-2.7k%2B-blueviolet?logo=slack&amp;logoColor=white"></a>
<a href="https://codecov.io/gh/jina-ai/clip-as-service"><img src="https://codecov.io/gh/jina-ai/clip-as-service/branch/main/graph/badge.svg?token=M7aC0FgIqd"/></a>
<a href="https://pypi.org/project/clip_server/"><img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/clip_server?logo=python&logoColor=white&style=flat-square"></a>
<a href="https://pypi.org/project/clip_server/"><img alt="PyPI" src="https://img.shields.io/pypi/v/clip_server?label=PyPI&logo=pypi&logoColor=white&style=flat-square"></a>
<a href="https://slack.jina.ai"><img src="https://img.shields.io/badge/Slack-2.7k%2B-blueviolet?logo=slack&amp;logoColor=white&style=flat-square"></a>
<a href="https://codecov.io/gh/jina-ai/clip-as-service"><img alt="Codecov branch" src="https://img.shields.io/codecov/c/github/jina-ai/clip-as-service/main?label=PyPI&logo=Codecov&logoColor=white&style=flat-square"></a>
</p>

<!-- start elevator-pitch -->
Expand Down
27 changes: 3 additions & 24 deletions client/clip_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,31 +295,10 @@ def _prepare_streaming(self, disable, total):
'the length of the input is unknown, the progressbar would not be accurate.'
)

from rich.progress import (
Progress,
BarColumn,
SpinnerColumn,
MofNCompleteColumn,
TextColumn,
TimeRemainingColumn,
)
from docarray.array.mixins.io.pbar import get_pbar

self._pbar = get_pbar(disable)

self._pbar = Progress(
SpinnerColumn(),
TextColumn('[bold]{task.description}'),
BarColumn(),
MofNCompleteColumn(),
'•',
TimeRemainingColumn(),
'•',
TextColumn(
'[bold blue]{task.fields[total_size]}',
justify='right',
style='progress.filesize',
),
transient=True,
disable=disable,
)
os.environ['JINA_GRPC_SEND_BYTES'] = '0'
os.environ['JINA_GRPC_RECV_BYTES'] = '0'

Expand Down
3 changes: 2 additions & 1 deletion client/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
long_description_content_type='text/markdown',
zip_safe=False,
setup_requires=['setuptools>=18.0', 'wheel'],
install_requires=['jina>=3.2.10', 'docarray[common]>=0.9.18'],
install_requires=['jina>=3.2.10', 'docarray[common]>=0.10.3'],
extras_require={
'test': [
'pytest',
Expand All @@ -64,6 +64,7 @@
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Unix Shell',
'Environment :: Console',
'License :: OSI Approved :: Apache Software License',
Expand Down
1 change: 1 addition & 0 deletions server/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Unix Shell',
'Environment :: Console',
'License :: OSI Approved :: Apache Software License',
Expand Down

0 comments on commit 35499b0

Please sign in to comment.