pixeltable 0.2.17__py3-none-any.whl → 0.2.19__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pixeltable might be problematic. Click here for more details.

Files changed (87) hide show
  1. pixeltable/__init__.py +1 -1
  2. pixeltable/__version__.py +2 -2
  3. pixeltable/catalog/catalog.py +8 -7
  4. pixeltable/catalog/column.py +11 -8
  5. pixeltable/catalog/insertable_table.py +1 -1
  6. pixeltable/catalog/path_dict.py +8 -6
  7. pixeltable/catalog/table.py +20 -14
  8. pixeltable/catalog/table_version.py +92 -55
  9. pixeltable/catalog/table_version_path.py +7 -9
  10. pixeltable/catalog/view.py +3 -2
  11. pixeltable/dataframe.py +2 -2
  12. pixeltable/env.py +205 -86
  13. pixeltable/exceptions.py +5 -1
  14. pixeltable/exec/aggregation_node.py +2 -1
  15. pixeltable/exec/component_iteration_node.py +2 -2
  16. pixeltable/exec/sql_node.py +11 -8
  17. pixeltable/exprs/__init__.py +2 -2
  18. pixeltable/exprs/arithmetic_expr.py +4 -4
  19. pixeltable/exprs/array_slice.py +2 -1
  20. pixeltable/exprs/column_property_ref.py +9 -7
  21. pixeltable/exprs/column_ref.py +2 -1
  22. pixeltable/exprs/comparison.py +10 -7
  23. pixeltable/exprs/compound_predicate.py +3 -2
  24. pixeltable/exprs/data_row.py +19 -4
  25. pixeltable/exprs/expr.py +51 -41
  26. pixeltable/exprs/expr_set.py +32 -9
  27. pixeltable/exprs/function_call.py +62 -40
  28. pixeltable/exprs/in_predicate.py +3 -2
  29. pixeltable/exprs/inline_expr.py +200 -0
  30. pixeltable/exprs/is_null.py +3 -2
  31. pixeltable/exprs/json_mapper.py +5 -4
  32. pixeltable/exprs/json_path.py +7 -1
  33. pixeltable/exprs/literal.py +34 -7
  34. pixeltable/exprs/method_ref.py +3 -3
  35. pixeltable/exprs/object_ref.py +6 -5
  36. pixeltable/exprs/row_builder.py +25 -17
  37. pixeltable/exprs/rowid_ref.py +2 -1
  38. pixeltable/exprs/similarity_expr.py +2 -1
  39. pixeltable/exprs/sql_element_cache.py +30 -0
  40. pixeltable/exprs/type_cast.py +3 -3
  41. pixeltable/exprs/variable.py +2 -1
  42. pixeltable/ext/functions/whisperx.py +6 -4
  43. pixeltable/ext/functions/yolox.py +11 -9
  44. pixeltable/func/aggregate_function.py +1 -0
  45. pixeltable/func/function.py +28 -4
  46. pixeltable/functions/__init__.py +4 -2
  47. pixeltable/functions/anthropic.py +15 -5
  48. pixeltable/functions/fireworks.py +1 -1
  49. pixeltable/functions/globals.py +6 -1
  50. pixeltable/functions/huggingface.py +91 -14
  51. pixeltable/functions/image.py +20 -5
  52. pixeltable/functions/json.py +5 -5
  53. pixeltable/functions/mistralai.py +188 -0
  54. pixeltable/functions/openai.py +6 -10
  55. pixeltable/functions/string.py +3 -2
  56. pixeltable/functions/timestamp.py +95 -7
  57. pixeltable/functions/together.py +18 -11
  58. pixeltable/functions/video.py +2 -2
  59. pixeltable/functions/vision.py +69 -37
  60. pixeltable/functions/whisper.py +4 -1
  61. pixeltable/globals.py +5 -1
  62. pixeltable/io/hf_datasets.py +17 -15
  63. pixeltable/io/pandas.py +0 -2
  64. pixeltable/io/parquet.py +15 -14
  65. pixeltable/iterators/document.py +16 -15
  66. pixeltable/metadata/__init__.py +1 -1
  67. pixeltable/metadata/converters/convert_18.py +1 -1
  68. pixeltable/metadata/converters/convert_19.py +46 -0
  69. pixeltable/metadata/converters/convert_20.py +56 -0
  70. pixeltable/metadata/converters/util.py +29 -4
  71. pixeltable/metadata/notes.py +2 -0
  72. pixeltable/metadata/schema.py +5 -4
  73. pixeltable/plan.py +100 -78
  74. pixeltable/store.py +5 -1
  75. pixeltable/tool/create_test_db_dump.py +18 -6
  76. pixeltable/type_system.py +15 -15
  77. pixeltable/utils/documents.py +45 -42
  78. pixeltable/utils/formatter.py +2 -2
  79. pixeltable-0.2.19.dist-info/LICENSE +201 -0
  80. {pixeltable-0.2.17.dist-info → pixeltable-0.2.19.dist-info}/METADATA +84 -24
  81. pixeltable-0.2.19.dist-info/RECORD +147 -0
  82. pixeltable/exprs/inline_array.py +0 -116
  83. pixeltable/exprs/inline_dict.py +0 -103
  84. pixeltable-0.2.17.dist-info/LICENSE +0 -18
  85. pixeltable-0.2.17.dist-info/RECORD +0 -144
  86. {pixeltable-0.2.17.dist-info → pixeltable-0.2.19.dist-info}/WHEEL +0 -0
  87. {pixeltable-0.2.17.dist-info → pixeltable-0.2.19.dist-info}/entry_points.txt +0 -0
@@ -1,69 +1,72 @@
1
- from typing import Optional, Dict
2
1
  import dataclasses
2
+ from typing import Optional
3
+
4
+ import bs4
5
+ import fitz # (pymupdf)
6
+ import puremagic
3
7
 
4
8
  import pixeltable.type_system as ts
9
+ from pixeltable.env import Env
5
10
 
6
11
 
7
12
  @dataclasses.dataclass
8
13
  class DocumentHandle:
9
14
  format: ts.DocumentType.DocumentFormat
10
- bs_doc: Optional['bs4.BeautifulSoup'] = None
11
- md_ast: Optional[Dict] = None
12
- pdf_doc: Optional['fitz.Document'] = None
15
+ bs_doc: Optional[bs4.BeautifulSoup] = None
16
+ md_ast: Optional[dict] = None
17
+ pdf_doc: Optional[fitz.Document] = None
18
+
13
19
 
14
20
  def get_document_handle(path: str) -> Optional[DocumentHandle]:
15
- # try pdf first, because a correct PDF is a binary format that
16
- # would trigger encoding exceptions if oppened as utf8.
17
- pdf_doc = get_pdf_handle(path)
18
- if pdf_doc is not None:
19
- return DocumentHandle(format=ts.DocumentType.DocumentFormat.PDF, pdf_doc=pdf_doc)
20
- # currently the rest of the types are text-based, so we can open them in utf8 mode once
21
- try:
22
- with open(path, 'r', encoding='utf8') as file:
23
- contents = file.read()
24
- except UnicodeDecodeError:
25
- # not pdf, and also not valid text file
26
- return None
21
+ doc_format = puremagic.from_file(path)
27
22
 
28
- # bs4 will appear to succeed for md files as well.
29
- # this will break most markdown files at the moment.
30
- bs_doc = get_html_handle(contents)
31
- if bs_doc is not None:
32
- return DocumentHandle(format=ts.DocumentType.DocumentFormat.HTML, bs_doc=bs_doc)
23
+ if doc_format == '.pdf':
24
+ pdf_doc = get_pdf_handle(path)
25
+ if pdf_doc is not None:
26
+ return DocumentHandle(format=ts.DocumentType.DocumentFormat.PDF, pdf_doc=pdf_doc)
33
27
 
34
- md_ast = get_markdown_handle(contents)
35
- if md_ast is not None:
36
- return DocumentHandle(format=ts.DocumentType.DocumentFormat.MD, md_ast=md_ast)
28
+ if doc_format == '.html':
29
+ bs_doc = get_html_handle(path)
30
+ if bs_doc is not None:
31
+ return DocumentHandle(format=ts.DocumentType.DocumentFormat.HTML, bs_doc=bs_doc)
32
+
33
+ if doc_format == '.md':
34
+ md_ast = get_markdown_handle(path)
35
+ if md_ast is not None:
36
+ return DocumentHandle(format=ts.DocumentType.DocumentFormat.MD, md_ast=md_ast)
37
37
 
38
38
  return None
39
39
 
40
- def get_html_handle(text: str) -> Optional['bs4.BeautifulSoup']:
41
- import bs4
40
+
41
+ def get_pdf_handle(path: str) -> Optional[fitz.Document]:
42
42
  try:
43
- doc = bs4.BeautifulSoup(text, 'html.parser')
44
- if doc.find() is None:
43
+ doc = fitz.open(path)
44
+ # check pdf (bc it will work for images)
45
+ if not doc.is_pdf:
45
46
  return None
47
+ # try to read one page
48
+ next(page for page in doc)
46
49
  return doc
47
50
  except Exception:
48
51
  return None
49
52
 
50
- def get_markdown_handle(text: str) -> Optional[Dict]:
51
- import mistune
53
+
54
+ def get_html_handle(path: str) -> Optional[bs4.BeautifulSoup]:
52
55
  try:
53
- md_ast = mistune.create_markdown(renderer=None)
54
- return md_ast(text)
56
+ with open(path, 'r', encoding='utf8') as fp:
57
+ doc = bs4.BeautifulSoup(fp, 'html.parser')
58
+ return doc if doc.find() is not None else None
55
59
  except Exception:
56
60
  return None
57
61
 
58
- def get_pdf_handle(path : str) -> Optional['fitz.Document']:
59
- import fitz # aka pymupdf
62
+
63
+ def get_markdown_handle(path: str) -> Optional[dict]:
64
+ Env.get().require_package('mistune', [3, 0])
65
+ import mistune
60
66
  try:
61
- doc = fitz.open(path)
62
- # check pdf (bc it will work for images)
63
- if not doc.is_pdf:
64
- return None
65
- # try to read one page
66
- next(page for page in doc)
67
- return doc
67
+ with open(path, encoding='utf8') as file:
68
+ text = file.read()
69
+ md_ast = mistune.create_markdown(renderer=None)
70
+ return md_ast(text)
68
71
  except Exception:
69
- return None
72
+ return None
@@ -144,11 +144,11 @@ class Formatter:
144
144
  else:
145
145
  width = 640 # A single image: larger display
146
146
  with io.BytesIO() as buffer:
147
- img.save(buffer, 'jpeg')
147
+ img.save(buffer, 'webp')
148
148
  img_base64 = base64.b64encode(buffer.getvalue()).decode()
149
149
  return f"""
150
150
  <div class="pxt_image" style="width:{width}px;">
151
- <img src="data:image/jpeg;base64,{img_base64}" width="{width}" />
151
+ <img src="data:image/webp;base64,{img_base64}" width="{width}" />
152
152
  </div>
153
153
  """
154
154
 
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pixeltable
3
- Version: 0.2.17
3
+ Version: 0.2.19
4
4
  Summary: Pixeltable: The Multimodal AI Data Plane
5
5
  Author: Pixeltable, Inc.
6
6
  Author-email: contact@pixeltable.com
@@ -16,9 +16,8 @@ Requires-Dist: cloudpickle (>=2.2.1,<3.0.0)
16
16
  Requires-Dist: ftfy (>=6.2.0,<7.0.0)
17
17
  Requires-Dist: jinja2 (>=3.1.3,<4.0.0)
18
18
  Requires-Dist: jmespath (>=1.0.1,<2.0.0)
19
- Requires-Dist: mistune (>=3.0.2,<4.0.0)
20
19
  Requires-Dist: more-itertools (>=10.2,<11.0)
21
- Requires-Dist: numpy (>=1.25)
20
+ Requires-Dist: numpy (>=1.25,<2.0)
22
21
  Requires-Dist: opencv-python-headless (>=4.7.0.68,<5.0.0.0)
23
22
  Requires-Dist: pandas (>=2.0,<3.0)
24
23
  Requires-Dist: pgvector (>=0.2.1,<0.3.0)
@@ -26,45 +25,41 @@ Requires-Dist: pillow (>=9.3.0)
26
25
  Requires-Dist: pixeltable-pgserver (==0.2.7)
27
26
  Requires-Dist: psutil (>=5.9.5,<6.0.0)
28
27
  Requires-Dist: psycopg[binary] (==3.1.18)
28
+ Requires-Dist: puremagic (>=1.20)
29
29
  Requires-Dist: pymupdf (>=1.24.1,<2.0.0)
30
30
  Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
31
31
  Requires-Dist: requests (>=2.31.0,<3.0.0)
32
- Requires-Dist: setuptools (==69.1.1)
33
- Requires-Dist: sqlalchemy[mypy] (>=2.0.23,<3.0.0)
32
+ Requires-Dist: sqlalchemy (>=2.0.23,<3.0.0)
34
33
  Requires-Dist: tenacity (>=8.2,<9.0)
35
34
  Requires-Dist: tqdm (>=4.64)
36
35
  Description-Content-Type: text/markdown
37
36
 
38
37
  <div align="center">
39
- <img src="https://raw.githubusercontent.com/pixeltable/pixeltable/main/docs/release/pixeltable-banner.png" alt="Pixeltable" width="45%" />
40
-
41
- # Unifying Data, Models, and Orchestration for AI Products
38
+ <img src="https://raw.githubusercontent.com/pixeltable/pixeltable/main/docs/source/data/pixeltable-logo-large.png" alt="Pixeltable" width="50%" />
39
+ <br></br>
42
40
 
43
41
  [![License](https://img.shields.io/badge/License-Apache%202.0-darkblue.svg)](https://opensource.org/licenses/Apache-2.0)
44
42
  ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pixeltable?logo=python&logoColor=white)
45
- [![Platform Support](https://img.shields.io/badge/platform-Linux%20%7C%20macOS%20%7C%20Windows-8A2BE2)]()
46
- [![pytest status](https://github.com/pixeltable/pixeltable/actions/workflows/pytest.yml/badge.svg)](https://github.com/pixeltable/pixeltable/actions)
43
+ ![Platform Support](https://img.shields.io/badge/platform-Linux%20%7C%20macOS%20%7C%20Windows-8A2BE2)
44
+ <br>
45
+ [![tests status](https://github.com/pixeltable/pixeltable/actions/workflows/pytest.yml/badge.svg)](https://github.com/pixeltable/pixeltable/actions/workflows/pytest.yml)
46
+ [![tests status](https://github.com/pixeltable/pixeltable/actions/workflows/nightly.yml/badge.svg)](https://github.com/pixeltable/pixeltable/actions/workflows/nightly.yml)
47
47
  [![PyPI Package](https://img.shields.io/pypi/v/pixeltable?color=darkorange)](https://pypi.org/project/pixeltable/)
48
48
 
49
49
  [Installation](https://pixeltable.github.io/pixeltable/getting-started/) | [Documentation](https://pixeltable.readme.io/) | [API Reference](https://pixeltable.github.io/pixeltable/) | [Code Samples](https://pixeltable.readme.io/recipes) | [Examples](https://github.com/pixeltable/pixeltable/tree/release/docs/release/tutorials)
50
50
  </div>
51
51
 
52
- Pixeltable is a Python library that lets ML Engineers and Data Scientists focus on exploration, modeling, and app development without dealing with the customary data plumbing.
53
-
54
- ### What problems does Pixeltable solve?
55
-
56
- Today’s solutions for AI app development require extensive custom coding and infrastructure plumbing. Tracking lineage and versions between and across data transformations, models, and deployment is cumbersome.
52
+ Pixeltable is a Python library providing a declarative interface for multimodal data (text, images, audio, video). It features built-in versioning, lineage tracking, and incremental updates, enabling users to store, transform, index, and iterate on data for their ML workflows. Data transformations, model inference, and custom logic are embedded as computed columns.
57
53
 
58
54
  ## 💾 Installation
59
55
 
60
56
  ```python
61
57
  pip install pixeltable
62
58
  ```
63
- > [!IMPORTANT]
64
- > Pixeltable is persistent. Unlike in-memory Python libraries such as Pandas, Pixeltable is a database. When working locally or against an hosted version of Pixeltable, use [get_table](https://pixeltable.github.io/pixeltable/api/pixeltable/#pixeltable.get_table) at any time to retrieve an existing table.
59
+ **Pixeltable is persistent. Unlike in-memory Python libraries such as Pandas, Pixeltable is a database.**
65
60
 
66
61
  ## 💡 Getting Started
67
- Learn how to create tables, populate them with data, and enhance them with built-in or user-defined transformations and AI operations.
62
+ Learn how to create tables, populate them with data, and enhance them with built-in or user-defined transformations.
68
63
 
69
64
  | Topic | Notebook | Topic | Notebook |
70
65
  |:----------|:-----------------|:-------------------------|:---------------------------------:|
@@ -91,9 +86,32 @@ v.insert({'video': prefix + p} for p in paths)
91
86
  ```
92
87
  Learn how to [work with data in Pixeltable](https://pixeltable.readme.io/docs/working-with-external-files).
93
88
 
94
- ### Add an object detection model to your workflow
89
+ ### Object detection in images using DETR model
95
90
  ```python
96
- table['detections'] = huggingface.detr_for_object_detection(table.input_image, model_id='facebook/detr-resnet-50')
91
+ import pixeltable as pxt
92
+ from pixeltable.functions import huggingface
93
+
94
+ # Create a table to store data persistently
95
+ t = pxt.create_table('image', {'image': pxt.ImageType()})
96
+
97
+ # Insert some images
98
+ prefix = 'https://upload.wikimedia.org/wikipedia/commons'
99
+ paths = [
100
+ '/1/15/Cat_August_2010-4.jpg',
101
+ '/e/e1/Example_of_a_Dog.jpg',
102
+ '/thumb/b/bf/Bird_Diversity_2013.png/300px-Bird_Diversity_2013.png'
103
+ ]
104
+ t.insert({'image': prefix + p} for p in paths)
105
+
106
+ # Add a computed column for image classification
107
+ t['classification'] = huggingface.detr_for_object_detection(
108
+ (t.image), model_id='facebook/detr-resnet-50'
109
+ )
110
+
111
+ # Retrieve the rows where cats have been identified
112
+ t.select(animal = t.image,
113
+ classification = t.classification.label_text[0]) \
114
+ .where(t.classification.label_text[0]=='cat').head()
97
115
  ```
98
116
  Learn about computed columns and object detection: [Comparing object detection models](https://pixeltable.readme.io/docs/object-detection-in-videos).
99
117
 
@@ -109,9 +127,9 @@ def draw_boxes(img: PIL.Image.Image, boxes: list[list[float]]) -> PIL.Image.Imag
109
127
  ```
110
128
  Learn more about user-defined functions: [UDFs in Pixeltable](https://pixeltable.readme.io/docs/user-defined-functions-udfs).
111
129
 
112
- ### Automate data operations with views
130
+ ### Automate data operations with views, e.g., split documents into chunks
113
131
  ```python
114
- # In this example, the view is defined by iteration over the chunks of a DocumentSplitter.
132
+ # In this example, the view is defined by iteration over the chunks of a DocumentSplitter
115
133
  chunks_table = pxt.create_view(
116
134
  'rag_demo.chunks',
117
135
  documents_table,
@@ -124,7 +142,7 @@ Learn how to leverage views to build your [RAG workflow](https://pixeltable.read
124
142
 
125
143
  ### Evaluate model performance
126
144
  ```python
127
- # The computation of the mAP metric can simply become a query over the evaluation output, aggregated with the mean_ap() function.
145
+ # The computation of the mAP metric can become a query over the evaluation output
128
146
  frames_view.select(mean_ap(frames_view.eval_yolox_tiny), mean_ap(frames_view.eval_yolox_m)).show()
129
147
  ```
130
148
  Learn how to leverage Pixeltable for [Model analytics](https://pixeltable.readme.io/docs/object-detection-in-videos).
@@ -136,7 +154,7 @@ chat_table = pxt.create_table('together_demo.chat', {'input': pxt.StringType()})
136
154
  # The chat-completions API expects JSON-formatted input:
137
155
  messages = [{'role': 'user', 'content': chat_table.input}]
138
156
 
139
- # This example shows how additional parameters from the Together API can be used in Pixeltable to customize the model behavior.
157
+ # This example shows how additional parameters from the Together API can be used in Pixeltable
140
158
  chat_table['output'] = chat_completions(
141
159
  messages=messages,
142
160
  model='mistralai/Mixtral-8x7B-Instruct-v0.1',
@@ -160,12 +178,54 @@ chat_table.select(chat_table.input, chat_table.response).head()
160
178
  ```
161
179
  Learn how to interact with inference services such as [Together AI](https://pixeltable.readme.io/docs/together-ai) in Pixeltable.
162
180
 
181
+ ### Text and image similarity search on video frames with embedding indexes
182
+ ```python
183
+ import pixeltable as pxt
184
+ from pixeltable.functions.huggingface import clip_image, clip_text
185
+ from pixeltable.iterators import FrameIterator
186
+ import PIL.Image
187
+
188
+ video_table = pxt.create_table('videos', {'video': pxt.VideoType()})
189
+
190
+ video_table.insert([{'video': '/video.mp4'}])
191
+
192
+ frames_view = pxt.create_view(
193
+ 'frames', video_table, iterator=FrameIterator.create(video=video_table.video))
194
+
195
+ @pxt.expr_udf
196
+ def embed_image(img: PIL.Image.Image):
197
+ return clip_image(img, model_id='openai/clip-vit-base-patch32')
198
+
199
+ @pxt.expr_udf
200
+ def str_embed(s: str):
201
+ return clip_text(s, model_id='openai/clip-vit-base-patch32')
202
+
203
+ # Create an index on the 'frame' column that allows text and image search
204
+ frames_view.add_embedding_index('frame', string_embed=str_embed, image_embed=embed_image)
205
+
206
+ # Now we will retrieve images based on a sample image
207
+ sample_image = '/image.jpeg'
208
+ sim = frames_view.frame.similarity(sample_image)
209
+ frames_view.order_by(sim, asc=False).limit(5).select(frames_view.frame, sim=sim).collect()
210
+
211
+ # Now we will retrieve images based on a string
212
+ sample_text = 'red truck'
213
+ sim = frames_view.frame.similarity(sample_text)
214
+ frames_view.order_by(sim, asc=False).limit(5).select(frames_view.frame, sim=sim).collect()
215
+
216
+ ```
217
+ Learn how to work with [Embedding and Vector Indexes](https://docs.pixeltable.com/docs/embedding-vector-indexes).
218
+
163
219
  ## ❓ FAQ
164
220
 
165
221
  ### What is Pixeltable?
166
222
 
167
223
  Pixeltable unifies data storage, versioning, and indexing with orchestration and model versioning under a declarative table interface, with transformations, model inference, and custom logic represented as computed columns.
168
224
 
225
+ ### What problems does Pixeltable solve?
226
+
227
+ Today's solutions for AI app development require extensive custom coding and infrastructure plumbing. Tracking lineage and versions between and across data transformations, models, and deployments is cumbersome. Pixeltable lets ML Engineers and Data Scientists focus on exploration, modeling, and app development without dealing with the customary data plumbing.
228
+
169
229
  ### What does Pixeltable provide me with? Pixeltable provides:
170
230
 
171
231
  - Data storage and versioning