Metadata-Version: 2.1
Name: jina
Version: 3.3.11
Summary: Jina is the cloud-native neural search framework for any kind of data
Home-page: https://github.com/jina-ai/jina/
Author: Jina AI
Author-email: hello@jina.ai
License: Apache 2.0
Download-URL: https://github.com/jina-ai/jina/tags
Project-URL: Documentation, https://docs.jina.ai
Project-URL: Source, https://github.com/jina-ai/jina/
Project-URL: Tracker, https://github.com/jina-ai/jina/issues
Description: <p align="center">
        <br><br><br>
        <a href="https://docs.jina.ai"><img src="https://github.com/jina-ai/jina/blob/master/docs/_static/logo-light.svg?raw=true" alt="Jina logo: Jina is a cloud-native neural search framework" width="150px"></a>
        <br><br><br>
        </p>
        
        <p align="center">
        <b>Cloud-Native Neural Search<sup><a href="https://docs.jina.ai/get-started/neural-search/">?</a></sup> Framework for <i>Any</i> Kind of Data</b>
        </p>
        
        
        <p align=center>
        <a href="https://pypi.org/project/jina/"><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" title="Jina supports Python 3.7 and above"></a>
        <a href="https://pypi.org/project/jina/"><img src="https://img.shields.io/pypi/v/jina?color=%23099cec&amp;label=PyPI&amp;logo=pypi&amp;logoColor=white" alt="PyPI"></a>
        <a href="https://codecov.io/gh/jina-ai/jina"><img src="https://codecov.io/gh/jina-ai/jina/branch/master/graph/badge.svg" alt="codecov"></a>
        <a href="https://slack.jina.ai"><img src="https://img.shields.io/badge/Slack-2.8k-blueviolet?logo=slack&amp;logoColor=white"></a>
        </p>
        
        <!-- start jina-description -->
        
        Jina is a neural search framework that empowers anyone to build SOTA and scalable neural search applications in minutes.
        
        ⏱️ **Save time** - *The* design pattern of neural search systems. Quickly build solutions for indexing, querying, understanding multi-/cross-modal data such as video, image, text, audio, source code, PDF.
        
        🌩️ **Local & cloud friendly** - Distributed architecture, scalable & cloud-native from day one. Same developer experience on local, [Docker Compose](https://docs.jina.ai/how-to/docker-compose/), [Kubernetes](https://docs.jina.ai/how-to/kubernetes/).
        
        🚀 **Serve, scale & share** - Serve a local project with HTTP, WebSockets or gRPC endpoints in just minutes. Scale your neural search applications to meet your availability and throughput requirements. Share and reuse building blocks from [Hub](https://hub.jina.ai).
        
        🍱 **Own your stack** - Keep end-to-end stack ownership of your solution. Avoid integration pitfalls you get with fragmented, multi-vendor, generic legacy tools. Enjoy the integration with the neural search ecosystem including [DocArray](https://docarray.jina.ai), [Hub](https://hub.jina.ai) and [Finetuner](https://finetuner.jina.ai).
        
        <!-- end jina-description -->
        
        ## Install 
        
        ```bash
        pip install jina
        ```
        
        For Jina 2.x users, please uninstall it via `pip uninstall jina` before installing Jina 3. Please also read [the 2 to 3 migration guide](https://docs.jina.ai/get-started/migrate/).
        
        More install options including Conda, Docker, and Windows [can be found here](https://docs.jina.ai/get-started/install/).
        
        ## [Documentation](https://docs.jina.ai)
        
        ## Get Started
        
        
        
        We promise you can build a **scalable** ResNet-powered image search **service** in 20 minutes or less, **from scratch to Kubernetes**. If not, you can forget about Jina.
        
        ### Basic Concepts
        
        Document, Executor and Flow are three fundamental concepts in Jina.
        
        - [**Document**](https://docarray.jina.ai/) is a data structure contains multi-modal data.
        - [**Executor**](https://docs.jina.ai/fundamentals/executor/) is a self-contained component and performs a group of tasks on Documents.
        - [**Flow**](https://docs.jina.ai/fundamentals/flow/) ties Executors together into a processing pipeline, provides scalability and facilitates deployments in the cloud.
        
        Leveraging these three concepts, let's build a simple image search service, as a "productization" of [DocArray README](https://github.com/jina-ai/docarray#a-complete-workflow-of-visual-search). 
        
        
        <p align="center">
        <a href="https://docs.jina.ai"><img src="https://github.com/jina-ai/jina/blob/master/.github/images/readme-banner1.svg?raw=true" alt="Get started with Jina to build production-ready neural search solution via ResNet in less than 20 minutes" width="100%"></a>
        </p>
        
        ### Build a service from scratch
        
        <sup>
        Preliminaries: <a href="https://pytorch.org/get-started/locally/">install PyTorch & Torchvision</a>
        </sup>
        
        1. Import what we need.
            ```python
            from docarray import Document, DocumentArray
            from jina import Executor, Flow, requests
            ```
        2. Copy-paste the preprocessing step and wrap it via `Executor`:
            ```python
            class PreprocImg(Executor):
                @requests
                async def foo(self, docs: DocumentArray, **kwargs):
                    for d in docs:
                        (
                            d.load_uri_to_image_tensor(200, 200)  # load
                            .set_image_tensor_normalization()  # normalize color
                            .set_image_tensor_channel_axis(
                                -1, 0
                            )  # switch color axis for the PyTorch model later
                        )
            ```
        3. Copy-paste the embedding step and wrap it via `Executor`:
            
            ```python   
            class EmbedImg(Executor):
                def __init__(self, **kwargs):
                    super().__init__(**kwargs)
                    import torchvision
                    self.model = torchvision.models.resnet50(pretrained=True)        
           
                @requests
                async def foo(self, docs: DocumentArray, **kwargs):
                    docs.embed(self.model)
            ```
        4. Wrap the matching step into an `Executor`:
            ```python
            class MatchImg(Executor):
                _da = DocumentArray()
        
                @requests(on='/index')
                async def index(self, docs: DocumentArray, **kwargs):
                    self._da.extend(docs)
                    docs.clear()  # clear content to save bandwidth
        
                @requests(on='/search')
                async def foo(self, docs: DocumentArray, **kwargs):
                    docs.match(self._da, limit=9)
                    del docs[...][:, ('embedding', 'tensor')]  # save bandwidth as it is not needed
            ```
        5. Connect all `Executor`s in a `Flow`, scale embedding to 3:
            ```python
            f = (
                Flow(port=12345)
                .add(uses=PreprocImg)
                .add(uses=EmbedImg, replicas=3)
                .add(uses=MatchImg)
            )
            ```
            Plot it via `f.plot('flow.svg')` and you get:
            
            <p align="center">
            <img src="https://github.com/jina-ai/jina/blob/master/.github/images/readme-flow-plot.svg?raw=true" title="Jina Flow.plot visualization" width="65%">
            </p>
            
        6. Download the image dataset.
        
        
        <table>
        <tr>
        <th> Pull from Cloud </th> 
        <th> Manually download, unzip and load </th>
        </tr>
        <tr>
        <td> 
        
        ```python
        index_data = DocumentArray.pull('demo-leftda', show_progress=True)
        ```
             
        </td>
        <td>
        
        1. Download `left.zip` from [Google Drive](https://sites.google.com/view/totally-looks-like-dataset)
        2. Unzip all images to `./left/`
        3. Load into DocumentArray
            ```python
            index_data = DocumentArray.from_files('left/*.jpg')
            ```
        
        </td>
        </tr>
        </table>
        
            
        7. Index image data:
            ```python
            with f:
                f.post(
                    '/index',
                    index_data,
                    show_progress=True,
                    request_size=8,
                )
                f.block()
            ```
        
        The full indexing on 6,000 images should take ~8 minutes on a MacBook Air 2020.
        
        Now you can use a Python client to access the service:
        
        ```python
        from jina import Client
        
        c = Client(port=12345)  # connect to localhost:12345
        print(c.post('/search', index_data[0])['@m'])  # '@m' is the matches-selector
        ```
        
        To switch from gRPC interface to REST API, you can simply set `protocol = 'http'`:
        
        ```python
        with f:
            ...
            f.protocol = 'http'
            f.block()
        ```
        
        Now you can query it via `curl`:
        
        <p align="center">
        <a href="https://docs.jina.ai"><img src="https://github.com/jina-ai/jina/blob/master/.github/images/readme-curl.png?raw=true" alt="Use curl to query image search service built by Jina & ResNet50" width="80%"></a>
        </p>
        
        Or go to `http://0.0.0.0:12345/docs` and test requests via a Swagger UI:
        
        <p align="center">
        <a href="https://docs.jina.ai"><img src="https://github.com/jina-ai/jina/blob/master/.github/images/readme-swagger-ui.gif?raw=true" alt="Visualize visual similar images in Jina using ResNet50" width="60%"></a>
        </p>
        
        
        
        
        <p align="center">
        <a href="https://docs.jina.ai"><img src="https://github.com/jina-ai/jina/blob/master/.github/images/readme-banner2.svg?raw=true" alt="Get started with Jina to build production-ready neural search solution via ResNet in less than 20 minutes" width="100%"></a>
        </p>
        
        ### Play with Containerized Executors
        
        You can containerize the Executors and use them in a sandbox thanks to [Hub](https://hub.jina.ai).
        
        1. Move each `Executor` class to a separate folder with one Python file in each:
           - `PreprocImg` -> 📁 `preproc_img/exec.py`
           - `EmbedImg` -> 📁 `embed_img/exec.py`
           - `MatchImg` -> 📁 `match_img/exec.py`
        2. Create a `requirements.txt` in `embed_img` as it requires `torchvision`.
        
            ```text
            .
            ├── embed_img
            │     ├── exec.py  # copy-paste codes of ImageEmbeddingExecutor
            │     └── requirements.txt  # add the requirement `torchvision`
            └── match_img
                  └── exec.py  # copy-paste codes of IndexExecutor
            └── preproc_img
                  └── exec.py  # copy-paste codes of IndexExecutor
            ```
        3. Push all Executors to the [Hub](https://hub.jina.ai):
            ```bash
            jina hub push preproc_img
            jina hub push embed_img
            jina hub push match_img
            ```
           You will get three Hub Executors that can be used via Sandbox, Docker container or source code. 
        
        <p align="center">
        <a href="https://docs.jina.ai"><img src="https://github.com/jina-ai/jina/blob/master/.github/images/readme-hub-push.png?raw=true" alt="Jina hub push gives you the sandbox" width="70%"></a>
        </p>
        
        4. In particular, Sandbox hosts your Executor on Jina Cloud and allows you to use it from your local machine:
            ```python
            from docarray import DocumentArray
            from jina import Flow
        
            index_data = DocumentArray.pull(
                'demo-leftda', show_progress=True
            )  # Download the dataset as shown in the tutorial above
        
            f = Flow().add(uses='jinahub+sandbox://2k7gsejl')
        
            with f:
                print(f.post('/', index_data[:10]))
            ```
        
        <p align="center">
        <a href="https://docs.jina.ai"><img alt="Shell outputs running docker-compose" src="https://github.com/jina-ai/jina/blob/master/.github/images/readme-sandbox-play.png?raw=ture" title="outputs of docker-compose" width="90%"></a>
        </p>
        
        
        <p align="center">
        <a href="https://docs.jina.ai"><img src="https://github.com/jina-ai/jina/blob/master/.github/images/readme-banner3.svg?raw=true" alt="Containerize, share and play in one-place like a pro" width="100%"></a>
        </p>
        
        
        ### Deploy the service via Docker Compose
        
        1. Now that all Executors are in containers, we can easily use Docker Compose to orchestrate the Flow:
        
            ```python
            f = (
                Flow(port=12345)
                .add(uses='jinahub+docker://1ylut0gf')
                .add(uses='jinahub+docker://258lzh3c')
            )
            f.to_docker_compose_yaml()  # By default, stored at `docker-compose.yml`
            ```
        
        2. Now in the console run:
        
            ```shell
            docker-compose up
            ```
        
        <p align="center">
        <a href="https://docs.jina.ai"><img alt="Shell outputs running docker-compose" src="https://github.com/jina-ai/jina/blob/master/.github/images/readme-docker-compose.png?raw=ture" title="She;; outputs of docker-compose"  width="85%"></a>
        </p>
        
        ### Deploy the service via Kubernetes
        
        1. Create a Kubernetes cluster and get credentials (example in GCP, [more K8s providers here](https://docs.jina.ai/advanced/experimental/kubernetes/#preliminaries)):
            ```bash
            gcloud container clusters create test --machine-type e2-highmem-2  --num-nodes 1 --zone europe-west3-a
            gcloud container clusters get-credentials test --zone europe-west3-a --project jina-showcase
            ```
        
        2. Create a namespace `flow-k8s-namespace` for demonstration purpose:
            ```bash
            kubectl create namespace flow-k8s-namespace
            ```
        
        3. Generate the kubernetes configuration files using one line of code:
            ```python
            f.to_k8s_yaml('./k8s_config', k8s_namespace='flow-k8s-namespace')
            ```
            
        4. Your `k8s_config` folder will look like the following:
            ```shell
            k8s_config
            ├── executor0
            │     ├── executor0-head.yml
            │     └── executor0.yml
            ├── executor1
            │     ├── executor1-head.yml
            │     └── executor1.yml
            └── gateway
                  └── gateway.yml
            ```
        
        5. Use `kubectl` to deploy your neural search application: 
        
            ```shell
            kubectl apply -R -f ./k8s_config
            ```
        
        <p align="center">
        <a href="https://docs.jina.ai"><img alt="Shell outputs running k8s" src="https://github.com/jina-ai/jina/blob/master/.github/images/readme-k8s.png?raw=ture" title="kubernetes outputs" width="70%"></a>
        </p>
        
        6. Run port forwarding so that you can send requests to your Kubernetes application from local CLI : 
        
            ```shell
            kubectl port-forward svc/gateway -n flow-k8s-namespace 12345:12345
            ```
        
        Now we have the service up running in Kubernetes!
        
        
        ## Run Quick Demo
        
        - [👗 Fashion image search](https://docs.jina.ai/get-started/hello-world/fashion/): `jina hello fashion`
        - [🤖 QA chatbot](https://docs.jina.ai/get-started/hello-world/covid-19-chatbot/): `pip install "jina[demo]" && jina hello chatbot`
        - [📰 Multimodal search](https://docs.jina.ai/get-started/hello-world/multimodal/): `pip install "jina[demo]" && jina hello multimodal`
        - 🍴 Fork the source of a demo to your folder: `jina hello fork fashion ../my-proj/`
        - Create a new Jina project: `jina new hello-jina`
        
        <!-- start support-pitch -->
        
        ## Support
        
        - Check out the [Learning Bootcamp](https://learn.jina.ai) to get started with Jina.
        - Join our [Slack community](https://slack.jina.ai) to chat to our engineers about your use cases, questions, and
          support queries.
        - Join our [Engineering All Hands](https://youtube.com/playlist?list=PL3UBBWOUVhFYRUa_gpYYKBqEAkO4sxmne) meet-up to
          discuss your use case and learn Jina's new features.
            - **When?** The second Tuesday of every month
            - **Where?**
              Zoom ([see our public calendar](https://calendar.google.com/calendar/embed?src=c_1t5ogfp2d45v8fit981j08mcm4%40group.calendar.google.com&ctz=Europe%2FBerlin)/[.ical](https://calendar.google.com/calendar/ical/c_1t5ogfp2d45v8fit981j08mcm4%40group.calendar.google.com/public/basic.ics)/[Meetup
              group](https://www.meetup.com/jina-community-meetup/))
              and [live stream on YouTube](https://youtube.com/c/jina-ai)
        - Subscribe to the latest video tutorials on our [YouTube channel](https://youtube.com/c/jina-ai)
        
        ## Join Us
        
        Jina is backed by [Jina AI](https://jina.ai) and licensed under [Apache-2.0](./LICENSE).
        [We are actively hiring](https://jobs.jina.ai) AI engineers, solution engineers to build the next neural search
        ecosystem in open source.
        
        <!-- end support-pitch -->
        
        ## Contribute
        
        We welcome all kinds of contributions from the open-source community, individuals and partners. We owe our success to
        your active involvement.
        
        - [Release cycles and development stages](RELEASE.md)
        - [Contributing guidelines](CONTRIBUTING.md)
        - [Code of conduct](https://github.com/jina-ai/jina/blob/master/.github/CODE_OF_CONDUCT.md)
        
Keywords: jina cloud-native neural-search query search index elastic neural-network encoding embedding serving docker container image video audio deep-learning
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Unix Shell
Classifier: Environment :: Console
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Database :: Database Engines/Servers
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
Classifier: Topic :: Scientific/Engineering :: Image Recognition
Classifier: Topic :: Multimedia :: Video
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Description-Content-Type: text/markdown
Provides-Extra: scipy
Provides-Extra: devel
Provides-Extra: standard
Provides-Extra: demo
Provides-Extra: fastapi
Provides-Extra: uvicorn[standard]
Provides-Extra: strawberry-graphql
Provides-Extra: graphql
Provides-Extra: cicd
Provides-Extra: docker
Provides-Extra: pathspec
Provides-Extra: rich
Provides-Extra: cryptography
Provides-Extra: filelock
Provides-Extra: requests
Provides-Extra: torch
Provides-Extra: transformers
Provides-Extra: tensorflow
Provides-Extra: torchvision
Provides-Extra: test
Provides-Extra: Pillow
Provides-Extra: perf
Provides-Extra: lz4
Provides-Extra: uvloop
Provides-Extra: core
Provides-Extra: numpy
Provides-Extra: protobuf
Provides-Extra: grpcio
Provides-Extra: grpcio-reflection
Provides-Extra: pyyaml
Provides-Extra: docarray
Provides-Extra: packaging
Provides-Extra: pytest
Provides-Extra: pytest-timeout
Provides-Extra: pytest-mock
Provides-Extra: pytest-cov
Provides-Extra: coverage
Provides-Extra: pytest-repeat
Provides-Extra: pytest-asyncio
Provides-Extra: pytest-reraise
Provides-Extra: flaky
Provides-Extra: mock
Provides-Extra: requests-mock
Provides-Extra: websockets
Provides-Extra: pydantic
Provides-Extra: python-multipart
Provides-Extra: aiofiles
Provides-Extra: aiohttp
Provides-Extra: pytest-custom_exit_code
Provides-Extra: bs4
Provides-Extra: aiostream
Provides-Extra: jsonschema
Provides-Extra: black
Provides-Extra: portforward
Provides-Extra: kubernetes
Provides-Extra: pytest-kind
Provides-Extra: pytest-lazy-fixture
Provides-Extra: sgqlc
Provides-Extra: prometheus_client
Provides-Extra: all
