Skip to content

Commit

Permalink
refactor: use docarray import and sorting (#4394)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwanglzu committed Feb 23, 2022
1 parent b3aae0f commit 7e6a39d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
10 changes: 6 additions & 4 deletions jina/helloworld/chatbot/app.py
Expand Up @@ -3,17 +3,18 @@
import webbrowser
from pathlib import Path

from docarray import DocumentArray

from jina import Flow
from jina.importer import ImportExtensions
from jina.logging.predefined import default_logger
from jina.logging.profile import ProgressBar
from jina.parsers.helloworld import set_hw_chatbot_parser
from jina import DocumentArray

if __name__ == '__main__':
from my_executors import MyTransformer, MyIndexer
from my_executors import MyIndexer, MyTransformer
else:
from .my_executors import MyTransformer, MyIndexer
from .my_executors import MyIndexer, MyTransformer


def _get_flow(args):
Expand All @@ -38,7 +39,8 @@ def hello_world(args):
help_text='this demo requires Pytorch and Transformers to be installed, '
'if you haven\'t, please do `pip install jina[torch,transformers]`',
):
import transformers, torch
import torch
import transformers

assert [torch, transformers] #: prevent pycharm auto remove the above line

Expand Down
2 changes: 1 addition & 1 deletion jina/helloworld/fashion/helper.py
Expand Up @@ -6,8 +6,8 @@
from collections import defaultdict

import numpy as np
from docarray import Document

from jina import Document
from jina.helper import colored
from jina.logging.predefined import default_logger
from jina.logging.profile import ProgressBar
Expand Down
7 changes: 5 additions & 2 deletions jina/helloworld/multimodal/app.py
Expand Up @@ -4,12 +4,13 @@
import zipfile
from pathlib import Path

from docarray import DocumentArray

from jina import Flow
from jina.importer import ImportExtensions
from jina.logging.predefined import default_logger
from jina.logging.profile import ProgressBar
from jina.parsers.helloworld import set_hw_multimodal_parser
from jina import DocumentArray

cur_dir = os.path.dirname(os.path.abspath(__file__))

Expand All @@ -27,7 +28,9 @@ def hello_world(args):
help_text='this demo requires Pytorch and Transformers to be installed, '
'if you haven\'t, please do `pip install jina[torch,transformers]`',
):
import transformers, torch, torchvision
import torch
import torchvision
import transformers

assert [
torch,
Expand Down

0 comments on commit 7e6a39d

Please sign in to comment.