pixeltable 0.2.7__py3-none-any.whl → 0.2.9__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.
- pixeltable/__init__.py +15 -33
- pixeltable/__version__.py +2 -2
- pixeltable/catalog/catalog.py +1 -1
- pixeltable/catalog/column.py +28 -16
- pixeltable/catalog/dir.py +2 -2
- pixeltable/catalog/insertable_table.py +5 -55
- pixeltable/catalog/named_function.py +2 -2
- pixeltable/catalog/schema_object.py +2 -7
- pixeltable/catalog/table.py +298 -204
- pixeltable/catalog/table_version.py +104 -139
- pixeltable/catalog/table_version_path.py +22 -4
- pixeltable/catalog/view.py +20 -10
- pixeltable/dataframe.py +128 -25
- pixeltable/env.py +21 -14
- pixeltable/exec/exec_context.py +5 -0
- pixeltable/exec/exec_node.py +1 -0
- pixeltable/exec/in_memory_data_node.py +29 -24
- pixeltable/exec/sql_scan_node.py +1 -1
- pixeltable/exprs/column_ref.py +13 -8
- pixeltable/exprs/data_row.py +4 -0
- pixeltable/exprs/expr.py +16 -1
- pixeltable/exprs/function_call.py +4 -4
- pixeltable/exprs/row_builder.py +29 -20
- pixeltable/exprs/similarity_expr.py +4 -3
- pixeltable/ext/functions/yolox.py +2 -1
- pixeltable/func/__init__.py +1 -0
- pixeltable/func/aggregate_function.py +14 -12
- pixeltable/func/callable_function.py +8 -6
- pixeltable/func/expr_template_function.py +13 -19
- pixeltable/func/function.py +3 -6
- pixeltable/func/query_template_function.py +84 -0
- pixeltable/func/signature.py +68 -23
- pixeltable/func/udf.py +13 -10
- pixeltable/functions/__init__.py +6 -91
- pixeltable/functions/eval.py +26 -14
- pixeltable/functions/fireworks.py +25 -23
- pixeltable/functions/globals.py +62 -0
- pixeltable/functions/huggingface.py +20 -16
- pixeltable/functions/image.py +170 -1
- pixeltable/functions/openai.py +95 -128
- pixeltable/functions/string.py +10 -2
- pixeltable/functions/together.py +95 -84
- pixeltable/functions/util.py +16 -0
- pixeltable/functions/video.py +94 -16
- pixeltable/functions/whisper.py +78 -0
- pixeltable/globals.py +1 -1
- pixeltable/io/__init__.py +10 -0
- pixeltable/io/external_store.py +370 -0
- pixeltable/io/globals.py +50 -22
- pixeltable/{datatransfer → io}/label_studio.py +279 -166
- pixeltable/io/parquet.py +1 -1
- pixeltable/iterators/__init__.py +9 -0
- pixeltable/iterators/string.py +40 -0
- pixeltable/metadata/__init__.py +6 -8
- pixeltable/metadata/converters/convert_10.py +2 -4
- pixeltable/metadata/converters/convert_12.py +7 -2
- pixeltable/metadata/converters/convert_13.py +6 -8
- pixeltable/metadata/converters/convert_14.py +2 -4
- pixeltable/metadata/converters/convert_15.py +40 -25
- pixeltable/metadata/converters/convert_16.py +18 -0
- pixeltable/metadata/converters/util.py +11 -8
- pixeltable/metadata/schema.py +3 -6
- pixeltable/plan.py +8 -7
- pixeltable/store.py +1 -1
- pixeltable/tool/create_test_db_dump.py +145 -54
- pixeltable/tool/embed_udf.py +9 -0
- pixeltable/type_system.py +1 -2
- pixeltable/utils/code.py +34 -0
- {pixeltable-0.2.7.dist-info → pixeltable-0.2.9.dist-info}/METADATA +2 -2
- pixeltable-0.2.9.dist-info/RECORD +131 -0
- pixeltable/datatransfer/__init__.py +0 -1
- pixeltable/datatransfer/remote.py +0 -113
- pixeltable/functions/pil/image.py +0 -147
- pixeltable-0.2.7.dist-info/RECORD +0 -126
- {pixeltable-0.2.7.dist-info → pixeltable-0.2.9.dist-info}/LICENSE +0 -0
- {pixeltable-0.2.7.dist-info → pixeltable-0.2.9.dist-info}/WHEEL +0 -0
pixeltable/io/globals.py
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
from typing import Any, Optional, Literal
|
|
2
2
|
|
|
3
|
-
import pixeltable as
|
|
3
|
+
import pixeltable.exceptions as excs
|
|
4
4
|
from pixeltable import Table
|
|
5
|
+
from pixeltable.io.external_store import SyncStatus
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
def create_label_studio_project(
|
|
8
9
|
t: Table,
|
|
9
10
|
label_config: str,
|
|
10
|
-
|
|
11
|
+
name: Optional[str] = None,
|
|
11
12
|
title: Optional[str] = None,
|
|
12
|
-
media_import_method: Literal['post', 'file'] = '
|
|
13
|
+
media_import_method: Literal['post', 'file', 'url'] = 'post',
|
|
14
|
+
col_mapping: Optional[dict[str, str]] = None,
|
|
13
15
|
sync_immediately: bool = True,
|
|
14
16
|
**kwargs: Any
|
|
15
|
-
) ->
|
|
17
|
+
) -> SyncStatus:
|
|
18
|
+
# TODO(aaron-siegel): Add link in docstring to a Label Studio howto
|
|
16
19
|
"""
|
|
17
20
|
Creates a new Label Studio project and links it to the specified `Table`.
|
|
18
21
|
|
|
@@ -27,33 +30,58 @@ def create_label_studio_project(
|
|
|
27
30
|
will always have a JSON-typed column `annotations` representing the output.
|
|
28
31
|
|
|
29
32
|
By default, Pixeltable will link each of these columns to a column of the specified `Table`
|
|
30
|
-
with the same name. If any of the data fields are missing, an exception will be
|
|
33
|
+
with the same name. If any of the data fields are missing, an exception will be raised. If
|
|
31
34
|
the `annotations` column is missing, it will be created. The default names can be overridden
|
|
32
35
|
by specifying an optional `col_mapping`, with Pixeltable column names as keys and Label
|
|
33
|
-
Studio field names as values.
|
|
36
|
+
Studio field names as values. In all cases, the Pixeltable columns must have types that are
|
|
37
|
+
consistent with their corresponding Label Studio fields; otherwise, an exception will be raised.
|
|
38
|
+
|
|
39
|
+
The API key and URL for a valid Label Studio server must be specified in Pixeltable config. Either:
|
|
40
|
+
|
|
41
|
+
* Set the `LABEL_STUDIO_API_KEY` and `LABEL_STUDIO_URL` environment variables; or
|
|
42
|
+
* Specify `api_key` and `url` fields in the `label-studio` section of `$PIXELTABLE_HOME/config.yaml`.
|
|
34
43
|
|
|
35
44
|
Args:
|
|
36
45
|
t: The Table to link to.
|
|
37
46
|
label_config: The Label Studio project configuration, in XML format.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
name: An optional name for the new project in Pixeltable. If specified, must be a valid
|
|
48
|
+
Pixeltable identifier and must not be the name of any other external data store
|
|
49
|
+
linked to `t`. If not specified, a default name will be used of the form
|
|
50
|
+
`ls_project_0`, `ls_project_1`, etc.
|
|
51
|
+
title: An optional title for the Label Studio project. This is the title that annotators
|
|
52
|
+
will see inside Label Studio. Unlike `name`, it does not need to be an identifier and
|
|
53
|
+
does not need to be unique. If not specified, the table name `t.get_name()` will be used.
|
|
54
|
+
media_import_method: The method to use when transferring media files to Label Studio:
|
|
55
|
+
- `post`: Media will be sent to Label Studio via HTTP post. This should generally only be used for
|
|
56
|
+
prototyping; due to restrictions in Label Studio, it can only be used with projects that have
|
|
57
|
+
just one data field, and does not scale well.
|
|
58
|
+
- `file`: Media will be sent to Label Studio as a file on the local filesystem. This method can be
|
|
59
|
+
used if Pixeltable and Label Studio are running on the same host.
|
|
60
|
+
- `url`: Media will be sent to Label Studio as externally accessible URLs. This method cannot be
|
|
61
|
+
used with local media files or with media generated by computed columns.
|
|
62
|
+
The default is `post`.
|
|
63
|
+
col_mapping: An optional mapping of local column names to Label Studio fields.
|
|
41
64
|
sync_immediately: If `True`, immediately perform an initial synchronization by
|
|
42
|
-
|
|
65
|
+
exporting all rows of the `Table` as Label Studio tasks.
|
|
66
|
+
kwargs: Additional keyword arguments are passed to the `start_project` method in the Label
|
|
67
|
+
Studio SDK, as described here:
|
|
68
|
+
https://labelstud.io/sdk/project.html#label_studio_sdk.project.Project.start_project
|
|
43
69
|
"""
|
|
44
|
-
from pixeltable.
|
|
70
|
+
from pixeltable.io.label_studio import LabelStudioProject
|
|
45
71
|
|
|
46
|
-
ls_project = LabelStudioProject.create(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
72
|
+
ls_project = LabelStudioProject.create(
|
|
73
|
+
t,
|
|
74
|
+
label_config,
|
|
75
|
+
name,
|
|
76
|
+
title,
|
|
77
|
+
media_import_method,
|
|
78
|
+
col_mapping,
|
|
79
|
+
**kwargs
|
|
80
|
+
)
|
|
55
81
|
|
|
56
82
|
# Link the project to `t`, and sync if appropriate.
|
|
57
|
-
t.
|
|
83
|
+
t._link_external_store(ls_project)
|
|
58
84
|
if sync_immediately:
|
|
59
|
-
t.sync()
|
|
85
|
+
return t.sync()
|
|
86
|
+
else:
|
|
87
|
+
return SyncStatus.empty()
|