nan commited on
Commit
5d64833
·
verified ·
1 Parent(s): c7891eb

update the examples

Browse files
Files changed (1) hide show
  1. README.md +35 -31
README.md CHANGED
@@ -45,19 +45,15 @@ curl https://api.jina.ai/v1/rerank \
45
  -H "Authorization: Bearer YOUR_API_KEY" \
46
  -d '{
47
  "model": "jina-reranker-m0",
48
- "query": "Organic skincare products for sensitive skin",
49
  "documents": [
50
- {"text": "Organic skincare for sensitive skin with aloe vera and chamomile."},
51
- {"text": "New makeup trends focus on bold colors and innovative techniques"},
52
- {"text": "Bio-Hautpflege für empfindliche Haut mit Aloe Vera und Kamille"},
53
- {"text": "Neue Make-up-Trends setzen auf kräftige Farben und innovative Techniken"},
54
- {"text": "Cuidado de la piel orgánico para piel sensible con aloe vera y manzanilla"},
55
- {"text": "Las nuevas tendencias de maquillaje se centran en colores vivos y técnicas innovadoras"},
56
- {"text": "针对敏感肌专门设计的天然有机护肤产品"},
57
- {"text": "新的化妆趋势注重鲜艳的颜色和创新的技巧"},
58
- {"text": "敏感肌のために特別に設計された天然有機スキンケア製品"},
59
- {"text": "新しいメイクのトレンドは鮮やかな色と革新的な技術に焦点を当てています"}
60
-
61
  ],
62
  "top_n": 3
63
  }'
@@ -83,34 +79,42 @@ model = AutoModel.from_pretrained(
83
 
84
  model.to('cuda') # or 'cpu' if no GPU is available
85
  model.eval()
86
-
87
  # Example query and documents
88
- query = "Organic skincare products for sensitive skin"
89
  documents = [
90
- "Organic skincare for sensitive skin with aloe vera and chamomile.",
91
- "New makeup trends focus on bold colors and innovative techniques",
92
- "Bio-Hautpflege für empfindliche Haut mit Aloe Vera und Kamille",
93
- "Neue Make-up-Trends setzen auf kräftige Farben und innovative Techniken",
94
- "Cuidado de la piel orgánico para piel sensible con aloe vera y manzanilla",
95
- "Las nuevas tendencias de maquillaje se centran en colores vivos y técnicas innovadoras",
96
- "针对敏感肌专门设计的天然有机护肤产品",
97
- "新的化妆趋势注重鲜艳的颜色和创新的技巧",
98
- "敏感肌のために特別に設計された天然有機スキンケア製品",
99
- "新しいメイクのトレンドは鮮やかな色と革新的な技術に焦点を当てています",
100
  ]
101
 
102
  # construct sentence pairs
103
- sentence_pairs = [[query, doc] for doc in documents]
104
 
105
- scores = model.compute_score(sentence_pairs, max_length=10240)
106
  ```
107
 
108
  The scores will be a list of floats, where each float represents the relevance score of the corresponding document to the query. Higher scores indicate higher relevance.
109
  For instance the returning scores in this case will be:
110
  ```bash
111
- [0.8311430811882019, 0.09401018172502518,
112
- 0.6334102749824524, 0.08269733935594559,
113
- 0.7620701193809509, 0.09947021305561066,
114
- 0.9263036847114563, 0.05834583938121796,
115
- 0.8418256044387817, 0.11124119907617569]
 
 
 
 
 
 
 
 
 
 
 
 
116
  ```
 
 
45
  -H "Authorization: Bearer YOUR_API_KEY" \
46
  -d '{
47
  "model": "jina-reranker-m0",
48
+ "query": "What are the top AI conferences in 2025?",
49
  "documents": [
50
+ {"text": "NeurIPS, ICML, and CVPR remain the leading AI research conferences in 2025."},
51
+ {"text": "CES showcases consumer technology advancements."},
52
+ {"text": "E3 is a major gaming expo featuring new console releases."},
53
+ {"text": "ACL EMNLP 是自然语言处理领域最重要的学术会议,每年都吸引顶尖研究人员。"},
54
+ {"text": "Die ICLR konzentriert sich auf neue Entwicklungen im Deep Learning und ist eine der einflussreichsten KI-Konferenzen."},
55
+ {"text": "قمة الويب في لشبونة تشمل مواضيع الذكاء الاصطناعي ولكنها ليست مؤتمرًا أكاديميًا متخصصًا."},
56
+
 
 
 
 
57
  ],
58
  "top_n": 3
59
  }'
 
79
 
80
  model.to('cuda') # or 'cpu' if no GPU is available
81
  model.eval()
 
82
  # Example query and documents
83
+ query = "What are the top AI conferences in 2025?"
84
  documents = [
85
+ "NeurIPS, ICML, and CVPR remain the leading AI research conferences in 2025." ,
86
+ "CES showcases consumer technology advancements.",
87
+ "E3 is a major gaming expo featuring new console releases.",
88
+ "ACL EMNLP 是自然语言处理领域最重要的学术会议,每年都吸引顶尖研究人员。",
89
+ "Die ICLR konzentriert sich auf neue Entwicklungen im Deep Learning und ist eine der einflussreichsten KI-Konferenzen.",
90
+ "قمة الويب في لشبونة تشمل مواضيع الذكاء الاصطناعي ولكنها ليست مؤتمرًا أكاديميًا متخصصًا."
 
 
 
 
91
  ]
92
 
93
  # construct sentence pairs
94
+ text_pairs = [[query, doc] for doc in documents]
95
 
96
+ scores = model.compute_score(text_pairs, max_length=1024, doc_type="text")
97
  ```
98
 
99
  The scores will be a list of floats, where each float represents the relevance score of the corresponding document to the query. Higher scores indicate higher relevance.
100
  For instance the returning scores in this case will be:
101
  ```bash
102
+ [0.9990890026092529, 0.9230391979217529, 0.8872045874595642, 0.9817357659339905, 0.9811668992042542, 0.9585376977920532]
103
+ ```
104
+
105
+ For handling the images, you can use the following code snippet:
106
+ ```python
107
+ # Example query and documents
108
+ query = "What is the ghibli style?"
109
+ documents = [
110
+ "https://static0.gamerantimages.com/wordpress/wp-content/uploads/2023/05/doraemon.jpg",
111
+ "https://static0.gamerantimages.com/wordpress/wp-content/uploads/2024/01/iconic-anime-manga-art-styles-hayao-miyazaki-isao-takahata.jpg",
112
+ ]
113
+
114
+ # construct sentence pairs
115
+ image_pairs = [[query, doc] for doc in documents]
116
+
117
+ scores = model.compute_score(image_pairs, max_length=2048, doc_type="image")
118
+ # [0.9688562154769897, 0.9886682629585266]
119
  ```
120
+