/examples

Jina examples and demos to help you get started

Primary LanguagePythonApache License 2.0Apache-2.0

Examples for Jina

Table of Contents

These examples showcase Jina in action and provide sample code for you to work from. We suggest you read Jina 101 and What is Neural Search? to get a conceptual overview.

โ—If you'd like to run our examples on Windows, please follow this instruction.

To learn more about how to use Jina, please refer to our docs.

๐Ÿฃ Simple Examples

๐Ÿ“„

Brand new to neural search? See a simple text-search example to understand how Jina works

๐Ÿ“„

Index more effectively by adding incremental indexing to your Wikipedia search

๐Ÿ“„

Get a better understanding of chunks by searching a lyrics database. Now with shiny front-end!

๐Ÿ–ผ๏ธ

Use SOTA visual representation for searching Pokรฉmon!

๐Ÿ–ผ๏ธ

Detect, index and query similar objects

๐ŸŽง

A demo of neural search for audio data based Vggish model.

๐ŸŽž๏ธ

Use prefetching and sharding to improve the performance of your index and query flow when searching animated GIFs.

๐Ÿš€ Advanced Examples

๐Ÿ“„

Build a vector search engine that finds the closest vector in the database to a query.

๐Ÿ–ผ๏ธ๐Ÿ“„

Use one modality (text) to search another (images)

๐Ÿ–ผ๏ธ๐Ÿ“„

Use more than one modality (image+text) to search images

๐Ÿ–ผ๏ธ๐Ÿ“„

Use different modalities (image, text or PDF) to search PDF

๐Ÿ—‚๏ธ

Create separate indexes and queries for different clothing in Fashion-MNIST

Community Examples

Want to add your own example? Please check our guidelines!

๐Ÿ“„

Opinionated QA passage retrieval with BERT-based reranker

Performance metrics

You can run the perf-script.sh in order to run all of the examples on your machine. Make sure this is done in a separate python virtualenv.

This measures QPS for indexing and querying.

This will store the results in performance.txt.

Note that a lot of the examples are not optimized (or configured for scaling). They are provided as is, for the basic functionality.

Adding Tests for Examples

You are highly encouraged to add a test for your example so that we will be alerted if it breaks in the future:

  1. Put your test data in the tests folder. The test data can be a few text sentences, images or audio samples
  2. Create test_[your_example].py in the tests folder. Add your test cases to the tests file with meaningful asserts depending on example input and output
  3. Run the test locally to confirm before pushing with pytest
  4. Add your example folder name to the path variable in matrix of .github/worflows/ci.yml. This will trigger your example test on creating a pull request.

Testing Tips

  • For reference, check out the tests folder from South Park example if your data is about text and object search example for images.
  • Try using the original example function by importing them to the test. Avoid any modifications to original Flow or logic.
  • Use the pytest fixture tmpdir for temporary directory

Community

  • Slack channel - a communication platform for developers to discuss Jina
  • LinkedIn - get to know Jina AI as a company and find job opportunities
  • Twitter Follow - follow us and interact with us using hashtag #JinaSearch
  • Company - know more about our company, we are fully committed to open-source!

License

Copyright (c) 2021 Jina AI Limited. All rights reserved.

Jina is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.