pensiev 0.25.5__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.
- memos/__init__.py +6 -0
- memos/cmds/__init__.py +0 -0
- memos/cmds/library.py +1289 -0
- memos/cmds/plugin.py +96 -0
- memos/commands.py +865 -0
- memos/config.py +225 -0
- memos/crud.py +605 -0
- memos/databases/__init__.py +0 -0
- memos/databases/initializers.py +481 -0
- memos/dataset_extractor_for_florence.py +165 -0
- memos/dataset_extractor_for_internvl2.py +192 -0
- memos/default_config.yaml +88 -0
- memos/embedding.py +129 -0
- memos/frame_extractor.py +53 -0
- memos/logging_config.py +35 -0
- memos/main.py +104 -0
- memos/migrations/alembic/README +1 -0
- memos/migrations/alembic/__pycache__/env.cpython-310.pyc +0 -0
- memos/migrations/alembic/env.py +108 -0
- memos/migrations/alembic/script.py.mako +30 -0
- memos/migrations/alembic/versions/00904ac8c6fc_add_indexes_to_entitymodel.py +63 -0
- memos/migrations/alembic/versions/04acdaf75664_add_indices_to_entitytags_and_metadata.py +86 -0
- memos/migrations/alembic/versions/12504c5b1d3c_add_extra_columns_for_embedding.py +67 -0
- memos/migrations/alembic/versions/31a1ad0e10b3_add_entity_plugin_status.py +71 -0
- memos/migrations/alembic/versions/__pycache__/00904ac8c6fc_add_indexes_to_entitymodel.cpython-310.pyc +0 -0
- memos/migrations/alembic/versions/__pycache__/04acdaf75664_add_indices_to_entitytags_and_metadata.cpython-310.pyc +0 -0
- memos/migrations/alembic/versions/__pycache__/12504c5b1d3c_add_extra_columns_for_embedding.cpython-310.pyc +0 -0
- memos/migrations/alembic/versions/__pycache__/20f5ecab014d_add_entity_plugin_status.cpython-310.pyc +0 -0
- memos/migrations/alembic/versions/__pycache__/31a1ad0e10b3_add_entity_plugin_status.cpython-310.pyc +0 -0
- memos/migrations/alembic/versions/__pycache__/4fcb062c5128_add_extra_columns_for_embedding.cpython-310.pyc +0 -0
- memos/migrations/alembic/versions/__pycache__/d10c55fbb7d2_add_index_for_entity_file_type_group_.cpython-310.pyc +0 -0
- memos/migrations/alembic/versions/__pycache__/f8f158182416_add_active_app_index.cpython-310.pyc +0 -0
- memos/migrations/alembic/versions/d10c55fbb7d2_add_index_for_entity_file_type_group_.py +44 -0
- memos/migrations/alembic/versions/f8f158182416_add_active_app_index.py +75 -0
- memos/migrations/alembic.ini +116 -0
- memos/migrations.py +19 -0
- memos/models.py +199 -0
- memos/plugins/__init__.py +0 -0
- memos/plugins/ocr/__init__.py +0 -0
- memos/plugins/ocr/main.py +251 -0
- memos/plugins/ocr/models/ch_PP-OCRv4_det_infer.onnx +0 -0
- memos/plugins/ocr/models/ch_PP-OCRv4_rec_infer.onnx +0 -0
- memos/plugins/ocr/models/ch_ppocr_mobile_v2.0_cls_train.onnx +0 -0
- memos/plugins/ocr/ppocr-gpu.yaml +43 -0
- memos/plugins/ocr/ppocr.yaml +44 -0
- memos/plugins/ocr/server.py +227 -0
- memos/plugins/ocr/temp_ppocr.yaml +42 -0
- memos/plugins/vlm/__init__.py +0 -0
- memos/plugins/vlm/main.py +251 -0
- memos/prepare_dataset.py +107 -0
- memos/process_webp.py +55 -0
- memos/read_metadata.py +32 -0
- memos/record.py +358 -0
- memos/schemas.py +289 -0
- memos/search.py +1198 -0
- memos/server.py +883 -0
- memos/shotsum.py +105 -0
- memos/shotsum_with_ocr.py +145 -0
- memos/simple_tokenizer/dict/README.md +31 -0
- memos/simple_tokenizer/dict/hmm_model.utf8 +34 -0
- memos/simple_tokenizer/dict/idf.utf8 +258826 -0
- memos/simple_tokenizer/dict/jieba.dict.utf8 +348982 -0
- memos/simple_tokenizer/dict/pos_dict/char_state_tab.utf8 +6653 -0
- memos/simple_tokenizer/dict/pos_dict/prob_emit.utf8 +166 -0
- memos/simple_tokenizer/dict/pos_dict/prob_start.utf8 +259 -0
- memos/simple_tokenizer/dict/pos_dict/prob_trans.utf8 +5222 -0
- memos/simple_tokenizer/dict/stop_words.utf8 +1534 -0
- memos/simple_tokenizer/dict/user.dict.utf8 +4 -0
- memos/simple_tokenizer/linux/libsimple.so +0 -0
- memos/simple_tokenizer/macos/libsimple.dylib +0 -0
- memos/simple_tokenizer/windows/simple.dll +0 -0
- memos/static/_app/immutable/assets/0.e250c031.css +1 -0
- memos/static/_app/immutable/assets/_layout.e7937cfe.css +1 -0
- memos/static/_app/immutable/chunks/index.5c08976b.js +1 -0
- memos/static/_app/immutable/chunks/index.60ee613b.js +4 -0
- memos/static/_app/immutable/chunks/runtime.a7926cf6.js +5 -0
- memos/static/_app/immutable/chunks/scheduler.5c1cff6e.js +1 -0
- memos/static/_app/immutable/chunks/singletons.583bdf4e.js +1 -0
- memos/static/_app/immutable/entry/app.666c1643.js +1 -0
- memos/static/_app/immutable/entry/start.aed5c701.js +3 -0
- memos/static/_app/immutable/nodes/0.5862ea38.js +7 -0
- memos/static/_app/immutable/nodes/1.35378a5e.js +1 -0
- memos/static/_app/immutable/nodes/2.1ccf9ea5.js +81 -0
- memos/static/_app/version.json +1 -0
- memos/static/app.html +36 -0
- memos/static/favicon.png +0 -0
- memos/static/logos/memos_logo_1024.png +0 -0
- memos/static/logos/memos_logo_1024@2x.png +0 -0
- memos/static/logos/memos_logo_128.png +0 -0
- memos/static/logos/memos_logo_128@2x.png +0 -0
- memos/static/logos/memos_logo_16.png +0 -0
- memos/static/logos/memos_logo_16@2x.png +0 -0
- memos/static/logos/memos_logo_256.png +0 -0
- memos/static/logos/memos_logo_256@2x.png +0 -0
- memos/static/logos/memos_logo_32.png +0 -0
- memos/static/logos/memos_logo_32@2x.png +0 -0
- memos/static/logos/memos_logo_512.png +0 -0
- memos/static/logos/memos_logo_512@2x.png +0 -0
- memos/static/logos/memos_logo_64.png +0 -0
- memos/static/logos/memos_logo_64@2x.png +0 -0
- memos/test_server.py +802 -0
- memos/utils.py +49 -0
- memos_ml_backends/florence2_server.py +176 -0
- memos_ml_backends/qwen2vl_server.py +182 -0
- memos_ml_backends/schemas.py +48 -0
- pensiev-0.25.5.dist-info/LICENSE +201 -0
- pensiev-0.25.5.dist-info/METADATA +541 -0
- pensiev-0.25.5.dist-info/RECORD +111 -0
- pensiev-0.25.5.dist-info/WHEEL +5 -0
- pensiev-0.25.5.dist-info/entry_points.txt +2 -0
- pensiev-0.25.5.dist-info/top_level.txt +2 -0
memos/cmds/plugin.py
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
import typer
|
2
|
+
import httpx
|
3
|
+
from tabulate import tabulate
|
4
|
+
from memos.config import settings
|
5
|
+
|
6
|
+
BASE_URL = settings.server_endpoint
|
7
|
+
|
8
|
+
|
9
|
+
plugin_app = typer.Typer()
|
10
|
+
|
11
|
+
|
12
|
+
def display_plugins(plugins):
|
13
|
+
table = []
|
14
|
+
for plugin in plugins:
|
15
|
+
table.append(
|
16
|
+
[plugin["id"], plugin["name"], plugin["description"], plugin["webhook_url"]]
|
17
|
+
)
|
18
|
+
print(
|
19
|
+
tabulate(
|
20
|
+
table,
|
21
|
+
headers=["ID", "Name", "Description", "Webhook URL"],
|
22
|
+
tablefmt="plain",
|
23
|
+
)
|
24
|
+
)
|
25
|
+
|
26
|
+
|
27
|
+
@plugin_app.command("ls")
|
28
|
+
def ls():
|
29
|
+
response = httpx.get(f"{BASE_URL}/plugins")
|
30
|
+
plugins = response.json()
|
31
|
+
display_plugins(plugins)
|
32
|
+
|
33
|
+
|
34
|
+
@plugin_app.command("create")
|
35
|
+
def create(name: str, webhook_url: str, description: str = ""):
|
36
|
+
response = httpx.post(
|
37
|
+
f"{BASE_URL}/plugins",
|
38
|
+
json={"name": name, "description": description, "webhook_url": webhook_url},
|
39
|
+
)
|
40
|
+
if 200 <= response.status_code < 300:
|
41
|
+
print("Plugin created successfully")
|
42
|
+
else:
|
43
|
+
print(f"Failed to create plugin: {response.status_code} - {response.text}")
|
44
|
+
|
45
|
+
|
46
|
+
@plugin_app.command("bind")
|
47
|
+
def bind(
|
48
|
+
library_id: int = typer.Option(..., "--lib", help="ID of the library"),
|
49
|
+
plugin: str = typer.Option(..., "--plugin", help="ID or name of the plugin"),
|
50
|
+
):
|
51
|
+
try:
|
52
|
+
plugin_id = int(plugin)
|
53
|
+
plugin_param = {"plugin_id": plugin_id}
|
54
|
+
except ValueError:
|
55
|
+
plugin_param = {"plugin_name": plugin}
|
56
|
+
|
57
|
+
# Check if the plugin is already bound to the library
|
58
|
+
response = httpx.get(f"{BASE_URL}/libraries/{library_id}")
|
59
|
+
if response.status_code == 200:
|
60
|
+
library_data = response.json()
|
61
|
+
bound_plugins = library_data.get("plugins", [])
|
62
|
+
if "plugin_id" in plugin_param:
|
63
|
+
if any(p["id"] == plugin_param["plugin_id"] for p in bound_plugins):
|
64
|
+
print("Plugin is already bound to the library")
|
65
|
+
return
|
66
|
+
elif "plugin_name" in plugin_param:
|
67
|
+
if any(p["name"] == plugin_param["plugin_name"] for p in bound_plugins):
|
68
|
+
print("Plugin is already bound to the library")
|
69
|
+
return
|
70
|
+
|
71
|
+
response = httpx.post(
|
72
|
+
f"{BASE_URL}/libraries/{library_id}/plugins",
|
73
|
+
json=plugin_param,
|
74
|
+
)
|
75
|
+
if response.status_code == 204:
|
76
|
+
print("Plugin bound to library successfully")
|
77
|
+
else:
|
78
|
+
print(
|
79
|
+
f"Failed to bind plugin to library: {response.status_code} - {response.text}"
|
80
|
+
)
|
81
|
+
|
82
|
+
|
83
|
+
@plugin_app.command("unbind")
|
84
|
+
def unbind(
|
85
|
+
library_id: int = typer.Option(..., "--lib", help="ID of the library"),
|
86
|
+
plugin_id: int = typer.Option(..., "--plugin", help="ID of the plugin"),
|
87
|
+
):
|
88
|
+
response = httpx.delete(
|
89
|
+
f"{BASE_URL}/libraries/{library_id}/plugins/{plugin_id}",
|
90
|
+
)
|
91
|
+
if response.status_code == 204:
|
92
|
+
print("Plugin unbound from library successfully")
|
93
|
+
else:
|
94
|
+
print(
|
95
|
+
f"Failed to unbind plugin from library: {response.status_code} - {response.text}"
|
96
|
+
)
|