Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
Merge pull request #349 from gnes-ai/fix-docs-flow
Browse files Browse the repository at this point in the history
docs(flow): fix formatting in flow docs
  • Loading branch information
Han Xiao authored Oct 21, 2019
2 parents da50be0 + c36444b commit 97efb59
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions gnes/flow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,11 @@ def train(self, bytes_gen: Iterator[bytes] = None, **kwargs):
.. highlight:: python
.. code-block:: python
with f.build(backend='thread') as flow:
flow.train(txt_file='aa.txt')
flow.train(image_zip_file='aa.zip', batch_size=64)
flow.train(video_zip_file='aa.zip')
...
with f.build(backend='thread') as flow:
flow.train(txt_file='aa.txt')
flow.train(image_zip_file='aa.zip', batch_size=64)
flow.train(video_zip_file='aa.zip')
...
This will call the pre-built reader to read files into an iterator of bytes and feed to the flow.
Expand All @@ -322,12 +322,12 @@ def train(self, bytes_gen: Iterator[bytes] = None, **kwargs):
.. highlight:: python
.. code-block:: python
def my_reader():
for _ in range(10):
yield b'abcdfeg' # each yield generates a document for training
def my_reader():
for _ in range(10):
yield b'abcdfeg' # each yield generates a document for training
with f.build(backend='thread') as flow:
flow.train(bytes_gen=my_reader())
with f.build(backend='thread') as flow:
flow.train(bytes_gen=my_reader())
:param bytes_gen: An iterator of bytes. If not given, then you have to specify it in `kwargs`.
:param kwargs: accepts all keyword arguments of `gnes client` CLI
Expand All @@ -342,11 +342,11 @@ def index(self, bytes_gen: Iterator[bytes] = None, **kwargs):
.. highlight:: python
.. code-block:: python
with f.build(backend='thread') as flow:
flow.index(txt_file='aa.txt')
flow.index(image_zip_file='aa.zip', batch_size=64)
flow.index(video_zip_file='aa.zip')
...
with f.build(backend='thread') as flow:
flow.index(txt_file='aa.txt')
flow.index(image_zip_file='aa.zip', batch_size=64)
flow.index(video_zip_file='aa.zip')
...
This will call the pre-built reader to read files into an iterator of bytes and feed to the flow.
Expand All @@ -358,12 +358,12 @@ def index(self, bytes_gen: Iterator[bytes] = None, **kwargs):
.. highlight:: python
.. code-block:: python
def my_reader():
for _ in range(10):
yield b'abcdfeg' # each yield generates a document to index
def my_reader():
for _ in range(10):
yield b'abcdfeg' # each yield generates a document to index
with f.build(backend='thread') as flow:
flow.index(bytes_gen=my_reader())
with f.build(backend='thread') as flow:
flow.index(bytes_gen=my_reader())
It will start a :py:class:`CLIClient` and call :py:func:`index`.
Expand All @@ -383,11 +383,11 @@ def query(self, bytes_gen: Iterator[bytes] = None, **kwargs):
.. highlight:: python
.. code-block:: python
with f.build(backend='thread') as flow:
flow.query(txt_file='aa.txt')
flow.query(image_zip_file='aa.zip', batch_size=64)
flow.query(video_zip_file='aa.zip')
...
with f.build(backend='thread') as flow:
flow.query(txt_file='aa.txt')
flow.query(image_zip_file='aa.zip', batch_size=64)
flow.query(video_zip_file='aa.zip')
...
This will call the pre-built reader to read files into an iterator of bytes and feed to the flow.
Expand All @@ -399,12 +399,12 @@ def query(self, bytes_gen: Iterator[bytes] = None, **kwargs):
.. highlight:: python
.. code-block:: python
def my_reader():
for _ in range(10):
yield b'abcdfeg' # each yield generates a query for searching
def my_reader():
for _ in range(10):
yield b'abcdfeg' # each yield generates a query for searching
with f.build(backend='thread') as flow:
flow.query(bytes_gen=my_reader())
with f.build(backend='thread') as flow:
flow.query(bytes_gen=my_reader())
:param bytes_gen: An iterator of bytes. If not given, then you have to specify it in `kwargs`.
:param kwargs: accepts all keyword arguments of `gnes client` CLI
Expand Down

0 comments on commit 97efb59

Please sign in to comment.