This repository has been archived by the owner on Nov 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 142
/
Copy pathflow-query.yml
44 lines (44 loc) · 2.22 KB
/
flow-query.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
jtype: Flow # This file defines the query flow which is used for searching in the indexed documents
version: '1' # The query flow is very similar to the index flow - only the differences are explained here
with:
prefetch: 10
port_expose: $JINA_PORT
workspace: $JINA_WORKSPACE
pods:
- name: loader # Again, we start two paths in the flow - here we start the image path
uses: ImageReader
py_modules: 'flows/executors.py'
read_only: true
needs: [gateway]
- name: image_encoder # Now, encode the images and compute the embeddings
uses: 'jinahub+docker://CLIPImageEncoder/v0.1'
volumes: $HOME/.cache/huggingface:/root/.cache/huggingface
timeout_ready: 600000
read_only: true
needs: loader
- name: text_indexer # Now, we use the text indexer in the image path - This is how we achieve the cross-modality here
uses: 'jinahub://SimpleIndexer/old' # The text indexer has indexed all text documents and stored them on disk.
uses_with: # Then we return the closest matches as results
index_file_name: 'text_index'
needs: image_encoder
force: True
read_only: true
- name: text_filter # Here, the text path starts
uses: TextFilter
py_modules: 'flows/executors.py'
needs: [gateway]
- name: text_encoder # Compute the embedding of the search text
uses: 'jinahub+docker://CLIPTextEncoder/v0.1'
volumes: $HOME/.cache/huggingface:/root/.cache/huggingface
timeout_ready: 600000
read_only: true
needs: text_filter
- name: image_indexer # Now, we use the image indexer in the text path - this is again how we get cross-modality
uses: 'jinahub://SimpleIndexer/old' # The image indexer has indexed all images and their embeddings
uses_with:
index_file_name: 'image_index'
force: True
read_only: true
needs: text_encoder
- name: join_all # Wait for both paths to finish and join the results
needs: [image_indexer, text_indexer]