blue-assistant 4.97.1__tar.gz → 4.121.1__tar.gz
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.
- {blue_assistant-4.97.1/blue_assistant.egg-info → blue_assistant-4.121.1}/PKG-INFO +6 -2
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/README.md +5 -1
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/.abcli/tests/script_run.sh +2 -1
- blue_assistant-4.121.1/blue_assistant/README.py +41 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/__init__.py +1 -1
- blue_assistant-4.121.1/blue_assistant/script/actions/__init__.py +16 -0
- blue_assistant-4.121.1/blue_assistant/script/actions/generate_image.py +52 -0
- blue_assistant-4.121.1/blue_assistant/script/actions/generate_text.py +85 -0
- blue_assistant-4.121.1/blue_assistant/script/actions/generic.py +15 -0
- blue_assistant-4.121.1/blue_assistant/script/actions/skip.py +15 -0
- blue_assistant-4.121.1/blue_assistant/script/repository/blue_amo/actions/__init__.py +13 -0
- blue_assistant-4.97.1/blue_assistant/script/repository/blue_amo/actions/slice_into_frames.py → blue_assistant-4.121.1/blue_assistant/script/repository/blue_amo/actions/slicing_into_frames.py +8 -5
- blue_assistant-4.121.1/blue_assistant/script/repository/blue_amo/actions/stitching_the_frames.py +128 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/script/repository/blue_amo/classes.py +7 -18
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/script/repository/generic/classes.py +8 -18
- {blue_assistant-4.97.1 → blue_assistant-4.121.1/blue_assistant.egg-info}/PKG-INFO +6 -2
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant.egg-info/SOURCES.txt +3 -4
- blue_assistant-4.97.1/blue_assistant/README.py +0 -33
- blue_assistant-4.97.1/blue_assistant/script/actions/__init__.py +0 -14
- blue_assistant-4.97.1/blue_assistant/script/actions/functions.py +0 -22
- blue_assistant-4.97.1/blue_assistant/script/actions/generate_image.py +0 -58
- blue_assistant-4.97.1/blue_assistant/script/actions/generate_text.py +0 -97
- blue_assistant-4.97.1/blue_assistant/script/actions/generic.py +0 -27
- blue_assistant-4.97.1/blue_assistant/script/actions/wip.py +0 -7
- blue_assistant-4.97.1/blue_assistant/script/repository/blue_amo/actions/__init__.py +0 -0
- blue_assistant-4.97.1/blue_assistant/script/repository/blue_amo/actions/stitch_the_frames.py +0 -81
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/LICENSE +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/MANIFEST.in +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/.abcli/abcli.sh +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/.abcli/actions.sh +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/.abcli/alias.sh +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/.abcli/blue_assistant.sh +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/.abcli/browse.sh +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/.abcli/script/list.sh +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/.abcli/script/run.sh +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/.abcli/script.sh +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/.abcli/tests/README.sh +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/.abcli/tests/help.sh +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/.abcli/tests/script_list.sh +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/.abcli/tests/version.sh +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/__main__.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/config.env +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/env.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/functions.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/help/__init__.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/help/__main__.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/help/functions.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/help/script.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/host.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/logger.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/sample.env +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/script/__init__.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/script/__main__.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/script/load.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/script/repository/__init__.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/script/repository/blue_amo/__init__.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/script/repository/generic/__init__.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/script/repository/moon_datasets/__init__.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/script/repository/moon_datasets/classes.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/urls.py +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant.egg-info/dependency_links.txt +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant.egg-info/requires.txt +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant.egg-info/top_level.txt +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/pyproject.toml +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/requirements.txt +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/setup.cfg +0 -0
- {blue_assistant-4.97.1 → blue_assistant-4.121.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: blue_assistant
|
3
|
-
Version: 4.
|
3
|
+
Version: 4.121.1
|
4
4
|
Summary: 🧠 An AI Assistant.
|
5
5
|
Home-page: https://github.com/kamangir/blue-assistant
|
6
6
|
Author: Arash Abadpour (Kamangir)
|
@@ -67,9 +67,13 @@ graph LR
|
|
67
67
|
classDef folder fill:#999,stroke:#333,stroke-width:2px;
|
68
68
|
```
|
69
69
|
|
70
|
+
| |
|
71
|
+
| --- |
|
72
|
+
| [`blue-amo`](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/blue_amo/README.md) [](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/blue_amo/README.md) story-telling with AI |
|
73
|
+
|
70
74
|
---
|
71
75
|
|
72
76
|
|
73
77
|
[](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml) [](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml) [](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml) [](https://pypi.org/project/blue-assistant/) [](https://pypistats.org/packages/blue-assistant)
|
74
78
|
|
75
|
-
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.
|
79
|
+
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.121.1`](https://github.com/kamangir/blue-assistant).
|
@@ -23,9 +23,13 @@ graph LR
|
|
23
23
|
classDef folder fill:#999,stroke:#333,stroke-width:2px;
|
24
24
|
```
|
25
25
|
|
26
|
+
| |
|
27
|
+
| --- |
|
28
|
+
| [`blue-amo`](./blue_assistant/script/repository/blue_amo/README.md) [](./blue_assistant/script/repository/blue_amo/README.md) story-telling with AI |
|
29
|
+
|
26
30
|
---
|
27
31
|
|
28
32
|
|
29
33
|
[](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml) [](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml) [](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml) [](https://pypi.org/project/blue-assistant/) [](https://pypistats.org/packages/blue-assistant)
|
30
34
|
|
31
|
-
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.
|
35
|
+
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.121.1`](https://github.com/kamangir/blue-assistant).
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import os
|
2
|
+
|
3
|
+
from blue_objects import file, README
|
4
|
+
|
5
|
+
from blue_assistant import NAME, VERSION, ICON, REPO_NAME
|
6
|
+
|
7
|
+
|
8
|
+
items = [
|
9
|
+
"[`{}`]({}) []({}) {}".format(
|
10
|
+
item["title"],
|
11
|
+
item["url"],
|
12
|
+
item["marquee"],
|
13
|
+
item["url"],
|
14
|
+
item["description"],
|
15
|
+
)
|
16
|
+
for item in [
|
17
|
+
{
|
18
|
+
"title": "blue-amo",
|
19
|
+
"url": "./blue_assistant/script/repository/blue_amo/README.md",
|
20
|
+
"marquee": "https://github.com/kamangir/assets/raw/main/blue-amo-2025-02-03-nswnx6/stitching_the_frames-2.png?raw=true",
|
21
|
+
"description": "story-telling with AI",
|
22
|
+
}
|
23
|
+
]
|
24
|
+
]
|
25
|
+
|
26
|
+
|
27
|
+
def build():
|
28
|
+
return all(
|
29
|
+
README.build(
|
30
|
+
items=readme.get("items", []),
|
31
|
+
path=os.path.join(file.path(__file__), readme["path"]),
|
32
|
+
ICON=ICON,
|
33
|
+
NAME=NAME,
|
34
|
+
VERSION=VERSION,
|
35
|
+
REPO_NAME=REPO_NAME,
|
36
|
+
)
|
37
|
+
for readme in [
|
38
|
+
{"items": items, "path": ".."},
|
39
|
+
{"path": "script/repository/blue_amo/README.md"},
|
40
|
+
]
|
41
|
+
)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
from typing import Dict, Callable, Tuple
|
2
|
+
|
3
|
+
from blue_assistant.script.repository.base.classes import BaseScript
|
4
|
+
from blue_assistant.script.actions.generic import generic_action
|
5
|
+
from blue_assistant.script.actions.generate_image import generate_image
|
6
|
+
from blue_assistant.script.actions.generate_text import generate_text
|
7
|
+
from blue_assistant.script.actions.skip import skip_action
|
8
|
+
from blue_assistant.logger import logger
|
9
|
+
|
10
|
+
|
11
|
+
dict_of_actions: Dict[str, Callable[[BaseScript, str], bool]] = {
|
12
|
+
"generic_action": generic_action,
|
13
|
+
"generate_image": generate_image,
|
14
|
+
"generate_text": generate_text,
|
15
|
+
"skip": skip_action,
|
16
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
from blueness import module
|
2
|
+
from blue_objects import objects
|
3
|
+
from openai_commands.image_generation.api import OpenAIImageGenerator
|
4
|
+
|
5
|
+
from blue_assistant import NAME
|
6
|
+
from blue_assistant.env import (
|
7
|
+
BLUE_ASSISTANT_IMAGE_DEFAULT_MODEL,
|
8
|
+
BLUE_ASSISTANT_IMAGE_DEFAULT_SIZE,
|
9
|
+
BLUE_ASSISTANT_IMAGE_DEFAULT_QUALITY,
|
10
|
+
)
|
11
|
+
from blue_assistant.script.repository.base.classes import BaseScript
|
12
|
+
from blue_assistant.logger import logger
|
13
|
+
|
14
|
+
NAME = module.name(__file__, NAME)
|
15
|
+
|
16
|
+
|
17
|
+
# https://platform.openai.com/docs/guides/images
|
18
|
+
def generate_image(
|
19
|
+
script: BaseScript,
|
20
|
+
node_name: str,
|
21
|
+
) -> bool:
|
22
|
+
logger.info(f"{NAME}: {script} @ {node_name} ...")
|
23
|
+
|
24
|
+
generator = OpenAIImageGenerator(
|
25
|
+
model=BLUE_ASSISTANT_IMAGE_DEFAULT_MODEL,
|
26
|
+
verbose=script.verbose,
|
27
|
+
)
|
28
|
+
|
29
|
+
filename = f"{node_name}.png"
|
30
|
+
|
31
|
+
success = generator.generate(
|
32
|
+
prompt=script.nodes[node_name]["prompt"],
|
33
|
+
filename=objects.path_of(
|
34
|
+
filename=filename,
|
35
|
+
object_name=script.object_name,
|
36
|
+
create=True,
|
37
|
+
),
|
38
|
+
quality=(BLUE_ASSISTANT_IMAGE_DEFAULT_QUALITY if script.test_mode else "hd"),
|
39
|
+
size=(BLUE_ASSISTANT_IMAGE_DEFAULT_SIZE if script.test_mode else "1792x1024"),
|
40
|
+
sign_with_prompt=False,
|
41
|
+
footer=[
|
42
|
+
script.nodes[node_name].get(
|
43
|
+
"summary_prompt",
|
44
|
+
script.nodes[node_name]["prompt"],
|
45
|
+
)
|
46
|
+
],
|
47
|
+
)[0]
|
48
|
+
|
49
|
+
if success:
|
50
|
+
script.nodes[node_name]["filename"] = filename
|
51
|
+
|
52
|
+
return success
|
@@ -0,0 +1,85 @@
|
|
1
|
+
from typing import List
|
2
|
+
from openai import OpenAI
|
3
|
+
import pprint
|
4
|
+
|
5
|
+
from blueness import module
|
6
|
+
from openai_commands.env import OPENAI_API_KEY
|
7
|
+
|
8
|
+
from blue_assistant import NAME
|
9
|
+
from blue_assistant.script.repository.base.classes import BaseScript
|
10
|
+
from blue_assistant.env import (
|
11
|
+
BLUE_ASSISTANT_TEXT_DEFAULT_MODEL,
|
12
|
+
BLUE_ASSISTANT_TEXT_MAX_TOKEN,
|
13
|
+
)
|
14
|
+
from blue_assistant.logger import logger
|
15
|
+
|
16
|
+
NAME = module.name(__file__, NAME)
|
17
|
+
|
18
|
+
|
19
|
+
# https://platform.openai.com/docs/guides/text-generation
|
20
|
+
def generate_text(
|
21
|
+
script: BaseScript,
|
22
|
+
node_name: str,
|
23
|
+
) -> bool:
|
24
|
+
if not OPENAI_API_KEY:
|
25
|
+
logger.error("OPENAI_API_KEY is not set.")
|
26
|
+
return False
|
27
|
+
|
28
|
+
logger.info(f"{NAME}: {script} @ {node_name} ...")
|
29
|
+
|
30
|
+
messages: List = []
|
31
|
+
list_of_context_nodes = script.get_history(node_name)
|
32
|
+
logger.info("node context: {}".format(" <- ".join(list_of_context_nodes)))
|
33
|
+
for context_node in reversed(list_of_context_nodes):
|
34
|
+
messages += [
|
35
|
+
{
|
36
|
+
"role": "user",
|
37
|
+
"content": [
|
38
|
+
{
|
39
|
+
"type": "text",
|
40
|
+
"text": script.apply_vars(script.nodes[context_node]["prompt"]),
|
41
|
+
}
|
42
|
+
],
|
43
|
+
}
|
44
|
+
]
|
45
|
+
|
46
|
+
if script.nodes[context_node].get("completed", False):
|
47
|
+
messages += [
|
48
|
+
{
|
49
|
+
"role": "assistant",
|
50
|
+
"content": [
|
51
|
+
{
|
52
|
+
"type": "text",
|
53
|
+
"text": script.nodes[context_node]["output"],
|
54
|
+
}
|
55
|
+
],
|
56
|
+
}
|
57
|
+
]
|
58
|
+
|
59
|
+
if script.verbose:
|
60
|
+
logger.info(f"messages: {pprint.pformat(messages)}")
|
61
|
+
|
62
|
+
client = OpenAI(api_key=OPENAI_API_KEY)
|
63
|
+
|
64
|
+
try:
|
65
|
+
response = client.chat.completions.create(
|
66
|
+
messages=messages,
|
67
|
+
model=BLUE_ASSISTANT_TEXT_DEFAULT_MODEL,
|
68
|
+
max_tokens=BLUE_ASSISTANT_TEXT_MAX_TOKEN,
|
69
|
+
)
|
70
|
+
except Exception as e:
|
71
|
+
logger.error(str(e))
|
72
|
+
return False
|
73
|
+
|
74
|
+
if script.verbose:
|
75
|
+
logger.info("response: {}".format(response))
|
76
|
+
|
77
|
+
if not response.choices:
|
78
|
+
logger.error("no choice.")
|
79
|
+
return False
|
80
|
+
|
81
|
+
output = response.choices[0].message.content
|
82
|
+
logger.info(f"🗣️ output: {output}")
|
83
|
+
script.nodes[node_name]["output"] = output
|
84
|
+
|
85
|
+
return True
|
@@ -0,0 +1,15 @@
|
|
1
|
+
from blueness import module
|
2
|
+
|
3
|
+
from blue_assistant import NAME
|
4
|
+
from blue_assistant.script.repository.base.classes import BaseScript
|
5
|
+
from blue_assistant.logger import logger
|
6
|
+
|
7
|
+
NAME = module.name(__file__, NAME)
|
8
|
+
|
9
|
+
|
10
|
+
def generic_action(
|
11
|
+
script: BaseScript,
|
12
|
+
node_name: str,
|
13
|
+
) -> bool:
|
14
|
+
logger.info(f"{NAME}: {script} @ {node_name} ...")
|
15
|
+
return True
|
@@ -0,0 +1,15 @@
|
|
1
|
+
from blueness import module
|
2
|
+
|
3
|
+
from blue_assistant import NAME
|
4
|
+
from blue_assistant.script.repository.base.classes import BaseScript
|
5
|
+
from blue_assistant.logger import logger
|
6
|
+
|
7
|
+
NAME = module.name(__file__, NAME)
|
8
|
+
|
9
|
+
|
10
|
+
def skip_action(
|
11
|
+
script: BaseScript,
|
12
|
+
node_name: str,
|
13
|
+
) -> bool:
|
14
|
+
logger.info(f"{NAME}: {script} @ {node_name} ...")
|
15
|
+
return True
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from typing import Dict, Callable
|
2
|
+
|
3
|
+
from blue_assistant.script.repository.base.classes import BaseScript
|
4
|
+
from blue_assistant.script.repository.blue_amo.actions import (
|
5
|
+
slicing_into_frames,
|
6
|
+
stitching_the_frames,
|
7
|
+
)
|
8
|
+
|
9
|
+
|
10
|
+
dict_of_actions: Dict[str, Callable[[BaseScript, str], bool]] = {
|
11
|
+
"slicing_into_frames": slicing_into_frames.slicing_into_frames,
|
12
|
+
"stitching_the_frames": stitching_the_frames.stitching_the_frames,
|
13
|
+
}
|
@@ -7,7 +7,7 @@ from blue_assistant.logger import logger
|
|
7
7
|
NAME = module.name(__file__, NAME)
|
8
8
|
|
9
9
|
|
10
|
-
def
|
10
|
+
def slicing_into_frames(
|
11
11
|
script: BaseScript,
|
12
12
|
node_name: str,
|
13
13
|
) -> bool:
|
@@ -25,11 +25,14 @@ def slice_into_frames(
|
|
25
25
|
list_of_frame_prompts += script.vars["frame_count"] * [""]
|
26
26
|
|
27
27
|
for index in range(script.vars["frame_count"]):
|
28
|
-
node_name = f"
|
28
|
+
node_name = f"generating_frame_{index+1:03d}"
|
29
29
|
|
30
|
-
script.nodes[node_name]["
|
31
|
-
|
32
|
-
|
30
|
+
script.nodes[node_name]["summary_prompt"] = list_of_frame_prompts[index]
|
31
|
+
|
32
|
+
script.nodes[node_name]["prompt"] = (
|
33
|
+
script.nodes[node_name]["prompt"]
|
34
|
+
.replace(":::story", " ".join(list_of_frame_prompts[:index]))
|
35
|
+
.replace(":::input", list_of_frame_prompts[index])
|
33
36
|
)
|
34
37
|
|
35
38
|
return True
|
blue_assistant-4.121.1/blue_assistant/script/repository/blue_amo/actions/stitching_the_frames.py
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
from typing import List
|
2
|
+
import numpy as np
|
3
|
+
import cv2
|
4
|
+
from tqdm import trange
|
5
|
+
import math
|
6
|
+
|
7
|
+
from blueness import module
|
8
|
+
from blue_objects import file, objects
|
9
|
+
from blue_options import string
|
10
|
+
|
11
|
+
from blue_assistant import NAME
|
12
|
+
from blue_assistant.script.repository.base.classes import BaseScript
|
13
|
+
from blue_assistant.logger import logger
|
14
|
+
|
15
|
+
NAME = module.name(__file__, NAME)
|
16
|
+
|
17
|
+
|
18
|
+
def stitching_the_frames(
|
19
|
+
script: BaseScript,
|
20
|
+
node_name: str,
|
21
|
+
) -> bool:
|
22
|
+
list_of_frames_filenames: List[str] = [
|
23
|
+
filename
|
24
|
+
for filename in [
|
25
|
+
script.nodes[node_name_].get("filename", "")
|
26
|
+
for node_name_ in [
|
27
|
+
f"generating_frame_{index+1:03d}"
|
28
|
+
for index in range(script.vars["frame_count"])
|
29
|
+
]
|
30
|
+
]
|
31
|
+
if filename
|
32
|
+
]
|
33
|
+
if not list_of_frames_filenames:
|
34
|
+
return True
|
35
|
+
|
36
|
+
logger.info(
|
37
|
+
"{} frames to stitch: {}".format(
|
38
|
+
len(list_of_frames_filenames),
|
39
|
+
", ".join(list_of_frames_filenames),
|
40
|
+
)
|
41
|
+
)
|
42
|
+
|
43
|
+
list_of_frames: List[np.ndarray] = []
|
44
|
+
for filename in list_of_frames_filenames:
|
45
|
+
success, frame = file.load_image(
|
46
|
+
objects.path_of(
|
47
|
+
filename=filename,
|
48
|
+
object_name=script.object_name,
|
49
|
+
)
|
50
|
+
)
|
51
|
+
|
52
|
+
if success:
|
53
|
+
list_of_frames += [frame]
|
54
|
+
|
55
|
+
if not list_of_frames:
|
56
|
+
return True
|
57
|
+
|
58
|
+
common_height = list_of_frames[0].shape[0]
|
59
|
+
common_width = list_of_frames[0].shape[1]
|
60
|
+
for index in trange(1, len(list_of_frames)):
|
61
|
+
frame_height = list_of_frames[index].shape[0]
|
62
|
+
frame_width = list_of_frames[index].shape[1]
|
63
|
+
|
64
|
+
if frame_height != common_height or frame_width != common_width:
|
65
|
+
list_of_frames[index] = cv2.resize(
|
66
|
+
list_of_frames[index],
|
67
|
+
(common_width, common_height),
|
68
|
+
interpolation=cv2.INTER_AREA,
|
69
|
+
)
|
70
|
+
|
71
|
+
width_count = int(math.ceil(math.sqrt(len(list_of_frames))))
|
72
|
+
height_count = int(math.ceil(len(list_of_frames) / width_count))
|
73
|
+
logger.info(
|
74
|
+
"{} x {} -> {} x {}".format(
|
75
|
+
len(list_of_frames),
|
76
|
+
string.pretty_shape_of_matrix(list_of_frames[0]),
|
77
|
+
height_count,
|
78
|
+
width_count,
|
79
|
+
)
|
80
|
+
)
|
81
|
+
|
82
|
+
list_of_frames += (height_count * width_count - len(list_of_frames)) * [
|
83
|
+
np.zeros_like(list_of_frames[0])
|
84
|
+
]
|
85
|
+
|
86
|
+
full_frame: np.ndarray = None
|
87
|
+
for height_index in trange(height_count):
|
88
|
+
row = np.concatenate(
|
89
|
+
list_of_frames[
|
90
|
+
height_index * width_count : (height_index + 1) * width_count
|
91
|
+
],
|
92
|
+
axis=1,
|
93
|
+
)
|
94
|
+
|
95
|
+
if not height_index:
|
96
|
+
full_frame = row
|
97
|
+
else:
|
98
|
+
full_frame = np.concatenate([full_frame, row], axis=0)
|
99
|
+
logger.info(f"full frame: {string.pretty_shape_of_matrix(full_frame)}")
|
100
|
+
|
101
|
+
for scale in [1, 2, 4]:
|
102
|
+
scaled_full_frame = (
|
103
|
+
full_frame
|
104
|
+
if scale == 1
|
105
|
+
else cv2.resize(
|
106
|
+
full_frame,
|
107
|
+
(
|
108
|
+
int(full_frame.shape[1] / scale),
|
109
|
+
int(full_frame.shape[0] / scale),
|
110
|
+
),
|
111
|
+
interpolation=cv2.INTER_AREA,
|
112
|
+
)
|
113
|
+
)
|
114
|
+
|
115
|
+
if not file.save_image(
|
116
|
+
objects.path_of(
|
117
|
+
filename="{}{}.png".format(
|
118
|
+
node_name,
|
119
|
+
"" if scale == 1 else f"-{scale}",
|
120
|
+
),
|
121
|
+
object_name=script.object_name,
|
122
|
+
),
|
123
|
+
scaled_full_frame,
|
124
|
+
log=True,
|
125
|
+
):
|
126
|
+
return False
|
127
|
+
|
128
|
+
return True
|
@@ -5,12 +5,7 @@ from blue_objects import file, path
|
|
5
5
|
|
6
6
|
from blue_assistant import NAME
|
7
7
|
from blue_assistant.script.repository.generic.classes import GenericScript
|
8
|
-
from blue_assistant.script.repository.blue_amo.actions
|
9
|
-
slice_into_frames,
|
10
|
-
)
|
11
|
-
from blue_assistant.script.repository.blue_amo.actions.stitch_the_frames import (
|
12
|
-
stitch_the_frames,
|
13
|
-
)
|
8
|
+
from blue_assistant.script.repository.blue_amo.actions import dict_of_actions
|
14
9
|
from blue_assistant.logger import logger
|
15
10
|
|
16
11
|
NAME = module.name(__file__, NAME)
|
@@ -34,7 +29,7 @@ class BlueAmoScript(GenericScript):
|
|
34
29
|
if self.test_mode:
|
35
30
|
self.vars["frame_count"] = 1
|
36
31
|
|
37
|
-
holder_node_name = "
|
32
|
+
holder_node_name = "generating_the_frames"
|
38
33
|
logger.info(
|
39
34
|
"{}: expanding {} X {}...".format(
|
40
35
|
NAME,
|
@@ -47,19 +42,19 @@ class BlueAmoScript(GenericScript):
|
|
47
42
|
del self.nodes[holder_node_name]
|
48
43
|
self.G.remove_node(holder_node_name)
|
49
44
|
|
50
|
-
reduce_node = "
|
45
|
+
reduce_node = "stitching_the_frames"
|
51
46
|
self.G.add_node(reduce_node)
|
52
47
|
self.nodes[reduce_node] = {"action": "skip"}
|
53
48
|
|
54
49
|
for index in range(self.vars["frame_count"]):
|
55
|
-
node_name = f"
|
50
|
+
node_name = f"generating_frame_{index+1:03d}"
|
56
51
|
|
57
52
|
self.nodes[node_name] = copy.deepcopy(holder_node)
|
58
53
|
|
59
54
|
self.G.add_node(node_name)
|
60
55
|
self.G.add_edge(
|
61
56
|
node_name,
|
62
|
-
"
|
57
|
+
"slicing_into_frames",
|
63
58
|
)
|
64
59
|
self.G.add_edge(
|
65
60
|
reduce_node,
|
@@ -75,14 +70,8 @@ class BlueAmoScript(GenericScript):
|
|
75
70
|
if not super().perform_action(node_name=node_name):
|
76
71
|
return False
|
77
72
|
|
78
|
-
if node_name
|
79
|
-
return
|
80
|
-
script=self,
|
81
|
-
node_name=node_name,
|
82
|
-
)
|
83
|
-
|
84
|
-
if node_name == "stitching-the-frames":
|
85
|
-
return stitch_the_frames(
|
73
|
+
if node_name in dict_of_actions:
|
74
|
+
return dict_of_actions[node_name](
|
86
75
|
script=self,
|
87
76
|
node_name=node_name,
|
88
77
|
)
|
{blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/script/repository/generic/classes.py
RENAMED
@@ -9,7 +9,7 @@ from blue_objects.metadata import post_to_object
|
|
9
9
|
|
10
10
|
from blue_assistant import NAME
|
11
11
|
from blue_assistant.script.repository.base.classes import BaseScript
|
12
|
-
from blue_assistant.script.actions
|
12
|
+
from blue_assistant.script.actions import dict_of_actions
|
13
13
|
from blue_assistant.logger import logger
|
14
14
|
|
15
15
|
|
@@ -24,25 +24,15 @@ class GenericScript(BaseScript):
|
|
24
24
|
node_name: str,
|
25
25
|
) -> bool:
|
26
26
|
action_name = self.nodes[node_name].get("action", "unknown")
|
27
|
-
if action_name == "skip":
|
28
|
-
return True
|
29
|
-
|
30
|
-
success, action_class = get_action_class(action_name=action_name)
|
31
|
-
if not success:
|
32
|
-
return success
|
33
|
-
|
34
|
-
logger.info(
|
35
|
-
"{}.perform_action: {} == {} on {}".format(
|
36
|
-
NAME,
|
37
|
-
action_name,
|
38
|
-
action_class.__name__,
|
39
|
-
node_name,
|
40
|
-
)
|
41
|
-
)
|
42
27
|
|
43
|
-
|
28
|
+
if action_name not in dict_of_actions:
|
29
|
+
logger.error(f"{action_name}: action not found.")
|
30
|
+
return False
|
44
31
|
|
45
|
-
return
|
32
|
+
return dict_of_actions[action_name](
|
33
|
+
script=self,
|
34
|
+
node_name=node_name,
|
35
|
+
)
|
46
36
|
|
47
37
|
def run(
|
48
38
|
self,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: blue_assistant
|
3
|
-
Version: 4.
|
3
|
+
Version: 4.121.1
|
4
4
|
Summary: 🧠 An AI Assistant.
|
5
5
|
Home-page: https://github.com/kamangir/blue-assistant
|
6
6
|
Author: Arash Abadpour (Kamangir)
|
@@ -67,9 +67,13 @@ graph LR
|
|
67
67
|
classDef folder fill:#999,stroke:#333,stroke-width:2px;
|
68
68
|
```
|
69
69
|
|
70
|
+
| |
|
71
|
+
| --- |
|
72
|
+
| [`blue-amo`](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/blue_amo/README.md) [](https://raw.githubusercontent.com/kamangir/blue-assistant/main/blue_assistant/script/repository/blue_amo/README.md) story-telling with AI |
|
73
|
+
|
70
74
|
---
|
71
75
|
|
72
76
|
|
73
77
|
[](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml) [](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml) [](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml) [](https://pypi.org/project/blue-assistant/) [](https://pypistats.org/packages/blue-assistant)
|
74
78
|
|
75
|
-
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.
|
79
|
+
built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.121.1`](https://github.com/kamangir/blue-assistant).
|
@@ -40,17 +40,16 @@ blue_assistant/script/__init__.py
|
|
40
40
|
blue_assistant/script/__main__.py
|
41
41
|
blue_assistant/script/load.py
|
42
42
|
blue_assistant/script/actions/__init__.py
|
43
|
-
blue_assistant/script/actions/functions.py
|
44
43
|
blue_assistant/script/actions/generate_image.py
|
45
44
|
blue_assistant/script/actions/generate_text.py
|
46
45
|
blue_assistant/script/actions/generic.py
|
47
|
-
blue_assistant/script/actions/
|
46
|
+
blue_assistant/script/actions/skip.py
|
48
47
|
blue_assistant/script/repository/__init__.py
|
49
48
|
blue_assistant/script/repository/blue_amo/__init__.py
|
50
49
|
blue_assistant/script/repository/blue_amo/classes.py
|
51
50
|
blue_assistant/script/repository/blue_amo/actions/__init__.py
|
52
|
-
blue_assistant/script/repository/blue_amo/actions/
|
53
|
-
blue_assistant/script/repository/blue_amo/actions/
|
51
|
+
blue_assistant/script/repository/blue_amo/actions/slicing_into_frames.py
|
52
|
+
blue_assistant/script/repository/blue_amo/actions/stitching_the_frames.py
|
54
53
|
blue_assistant/script/repository/generic/__init__.py
|
55
54
|
blue_assistant/script/repository/generic/classes.py
|
56
55
|
blue_assistant/script/repository/moon_datasets/__init__.py
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
|
3
|
-
from blue_objects import file, README
|
4
|
-
|
5
|
-
from blue_assistant import NAME, VERSION, ICON, REPO_NAME
|
6
|
-
|
7
|
-
|
8
|
-
items = [
|
9
|
-
"{}[`{}`](#) [](#) {}".format(
|
10
|
-
ICON,
|
11
|
-
f"feature {index}",
|
12
|
-
"https://github.com/kamangir/assets/raw/main/blue-assistant/marquee.png?raw=true",
|
13
|
-
f"description of feature {index} ...",
|
14
|
-
)
|
15
|
-
for index in range(1, 4)
|
16
|
-
]
|
17
|
-
|
18
|
-
|
19
|
-
def build():
|
20
|
-
return all(
|
21
|
-
README.build(
|
22
|
-
items=readme.get("items", []),
|
23
|
-
path=os.path.join(file.path(__file__), readme["path"]),
|
24
|
-
ICON=ICON,
|
25
|
-
NAME=NAME,
|
26
|
-
VERSION=VERSION,
|
27
|
-
REPO_NAME=REPO_NAME,
|
28
|
-
)
|
29
|
-
for readme in [
|
30
|
-
{"items": items, "path": ".."},
|
31
|
-
{"path": "docs/blue-amo-01.md"},
|
32
|
-
]
|
33
|
-
)
|
@@ -1,14 +0,0 @@
|
|
1
|
-
from typing import List
|
2
|
-
|
3
|
-
from blue_assistant.script.actions.generic import GenericAction
|
4
|
-
from blue_assistant.script.actions.generate_image import GenerateImageAction
|
5
|
-
from blue_assistant.script.actions.generate_text import GenerateTextAction
|
6
|
-
from blue_assistant.script.actions.wip import WorkInProgressAction
|
7
|
-
from blue_assistant.logger import logger
|
8
|
-
|
9
|
-
list_of_actions: List[GenericAction] = [
|
10
|
-
GenericAction,
|
11
|
-
GenerateImageAction,
|
12
|
-
GenerateTextAction,
|
13
|
-
WorkInProgressAction,
|
14
|
-
]
|
@@ -1,22 +0,0 @@
|
|
1
|
-
from typing import List, Dict, Tuple, Type
|
2
|
-
|
3
|
-
from blueness import module
|
4
|
-
from blue_assistant.script.actions.generic import GenericAction
|
5
|
-
from blue_assistant.script.repository.base.classes import BaseScript
|
6
|
-
from blue_assistant.script.actions import list_of_actions
|
7
|
-
|
8
|
-
from blue_assistant import NAME
|
9
|
-
from blue_assistant.logger import logger
|
10
|
-
|
11
|
-
NAME = module.name(__file__, NAME)
|
12
|
-
|
13
|
-
|
14
|
-
def get_action_class(
|
15
|
-
action_name: str,
|
16
|
-
) -> Tuple[bool, Type[GenericAction]]:
|
17
|
-
for action_class in list_of_actions:
|
18
|
-
if action_class.name == action_name:
|
19
|
-
return True, action_class
|
20
|
-
|
21
|
-
logger.error(f"{action_name}: action not found.")
|
22
|
-
return False, GenericAction
|
@@ -1,58 +0,0 @@
|
|
1
|
-
from blue_objects import file, objects
|
2
|
-
from openai_commands.image_generation.api import OpenAIImageGenerator
|
3
|
-
|
4
|
-
from blue_assistant.env import (
|
5
|
-
BLUE_ASSISTANT_IMAGE_DEFAULT_MODEL,
|
6
|
-
BLUE_ASSISTANT_IMAGE_DEFAULT_SIZE,
|
7
|
-
BLUE_ASSISTANT_IMAGE_DEFAULT_QUALITY,
|
8
|
-
)
|
9
|
-
from blue_assistant.script.actions.generic import GenericAction
|
10
|
-
from blue_assistant.script.repository.base.classes import BaseScript
|
11
|
-
from blue_assistant.logger import logger
|
12
|
-
|
13
|
-
|
14
|
-
class GenerateImageAction(GenericAction):
|
15
|
-
name = file.name(__file__)
|
16
|
-
|
17
|
-
def __init__(
|
18
|
-
self,
|
19
|
-
script: BaseScript,
|
20
|
-
):
|
21
|
-
super().__init__(script=script)
|
22
|
-
|
23
|
-
self.generator = OpenAIImageGenerator(
|
24
|
-
model=BLUE_ASSISTANT_IMAGE_DEFAULT_MODEL,
|
25
|
-
verbose=self.script.verbose,
|
26
|
-
)
|
27
|
-
|
28
|
-
# https://platform.openai.com/docs/guides/images
|
29
|
-
def perform(
|
30
|
-
self,
|
31
|
-
node_name: str,
|
32
|
-
) -> bool:
|
33
|
-
if not super().perform(node_name=node_name):
|
34
|
-
return False
|
35
|
-
|
36
|
-
filename = f"{node_name}.png"
|
37
|
-
|
38
|
-
success = self.generator.generate(
|
39
|
-
prompt=self.script.nodes[node_name]["prompt"],
|
40
|
-
filename=objects.path_of(
|
41
|
-
filename=filename,
|
42
|
-
object_name=self.script.object_name,
|
43
|
-
create=True,
|
44
|
-
),
|
45
|
-
quality=(
|
46
|
-
BLUE_ASSISTANT_IMAGE_DEFAULT_QUALITY if self.script.test_mode else "hd"
|
47
|
-
),
|
48
|
-
size=(
|
49
|
-
BLUE_ASSISTANT_IMAGE_DEFAULT_SIZE
|
50
|
-
if self.script.test_mode
|
51
|
-
else "1792x1024"
|
52
|
-
),
|
53
|
-
)[0]
|
54
|
-
|
55
|
-
if success:
|
56
|
-
self.script.nodes[node_name]["filename"] = filename
|
57
|
-
|
58
|
-
return success
|
@@ -1,97 +0,0 @@
|
|
1
|
-
from typing import Dict, Tuple, List
|
2
|
-
from openai import OpenAI
|
3
|
-
import pprint
|
4
|
-
|
5
|
-
from blueness import module
|
6
|
-
from blue_objects import file
|
7
|
-
from openai_commands.env import OPENAI_API_KEY
|
8
|
-
|
9
|
-
from blue_assistant import NAME
|
10
|
-
from blue_assistant.env import (
|
11
|
-
BLUE_ASSISTANT_TEXT_DEFAULT_MODEL,
|
12
|
-
BLUE_ASSISTANT_TEXT_MAX_TOKEN,
|
13
|
-
)
|
14
|
-
from blue_assistant.script.actions.generic import GenericAction
|
15
|
-
from blue_assistant.logger import logger
|
16
|
-
|
17
|
-
NAME = module.name(__file__, NAME)
|
18
|
-
|
19
|
-
|
20
|
-
class GenerateTextAction(GenericAction):
|
21
|
-
name = file.name(__file__)
|
22
|
-
|
23
|
-
# https://platform.openai.com/docs/guides/text-generation
|
24
|
-
def perform(
|
25
|
-
self,
|
26
|
-
node_name: str,
|
27
|
-
) -> bool:
|
28
|
-
if not OPENAI_API_KEY:
|
29
|
-
logger.error("OPENAI_API_KEY is not set.")
|
30
|
-
return False
|
31
|
-
|
32
|
-
if not super().perform(node_name=node_name):
|
33
|
-
return False
|
34
|
-
|
35
|
-
messages: List = []
|
36
|
-
list_of_context_nodes = self.script.get_history(node_name)
|
37
|
-
logger.info("node context: {}".format(" <- ".join(list_of_context_nodes)))
|
38
|
-
for context_node in reversed(list_of_context_nodes):
|
39
|
-
messages += [
|
40
|
-
{
|
41
|
-
"role": "user",
|
42
|
-
"content": [
|
43
|
-
{
|
44
|
-
"type": "text",
|
45
|
-
"text": self.script.apply_vars(
|
46
|
-
self.script.nodes[context_node]["prompt"]
|
47
|
-
),
|
48
|
-
}
|
49
|
-
],
|
50
|
-
}
|
51
|
-
]
|
52
|
-
|
53
|
-
if self.script.nodes[context_node].get("completed", False):
|
54
|
-
messages += [
|
55
|
-
{
|
56
|
-
"role": "assistant",
|
57
|
-
"content": [
|
58
|
-
{
|
59
|
-
"type": "text",
|
60
|
-
"text": self.script.nodes[context_node]["output"],
|
61
|
-
}
|
62
|
-
],
|
63
|
-
}
|
64
|
-
]
|
65
|
-
|
66
|
-
if self.script.verbose:
|
67
|
-
logger.info(f"messages: {pprint.pformat(messages)}")
|
68
|
-
|
69
|
-
client = OpenAI(api_key=OPENAI_API_KEY)
|
70
|
-
|
71
|
-
try:
|
72
|
-
response = client.chat.completions.create(
|
73
|
-
messages=messages,
|
74
|
-
model=BLUE_ASSISTANT_TEXT_DEFAULT_MODEL,
|
75
|
-
max_tokens=BLUE_ASSISTANT_TEXT_MAX_TOKEN,
|
76
|
-
)
|
77
|
-
except Exception as e:
|
78
|
-
logger.error(str(e))
|
79
|
-
return False
|
80
|
-
|
81
|
-
if self.script.verbose:
|
82
|
-
logger.info("response: {}".format(response))
|
83
|
-
|
84
|
-
if not response.choices:
|
85
|
-
logger.error("no choice.")
|
86
|
-
return False
|
87
|
-
|
88
|
-
output = response.choices[0].message.content
|
89
|
-
logger.info(f"🗣️ output: {output}")
|
90
|
-
|
91
|
-
self.script.nodes[node_name]["output"] = output
|
92
|
-
|
93
|
-
var_name = self.script.nodes[node_name].get("output", "")
|
94
|
-
if var_name:
|
95
|
-
self.script.vars[var_name] = output
|
96
|
-
|
97
|
-
return True
|
@@ -1,27 +0,0 @@
|
|
1
|
-
from blue_objects import file
|
2
|
-
|
3
|
-
from blue_assistant.script.repository.base.classes import BaseScript
|
4
|
-
from blue_assistant.logger import logger
|
5
|
-
|
6
|
-
|
7
|
-
class GenericAction:
|
8
|
-
name = file.name(__file__)
|
9
|
-
|
10
|
-
def __init__(
|
11
|
-
self,
|
12
|
-
script: BaseScript,
|
13
|
-
):
|
14
|
-
self.script = script
|
15
|
-
|
16
|
-
def perform(
|
17
|
-
self,
|
18
|
-
node_name: str,
|
19
|
-
) -> bool:
|
20
|
-
logger.info(
|
21
|
-
"{}.perform on {}.{} ...".format(
|
22
|
-
self.__class__.__name__,
|
23
|
-
self.script.name,
|
24
|
-
node_name,
|
25
|
-
),
|
26
|
-
)
|
27
|
-
return True
|
File without changes
|
blue_assistant-4.97.1/blue_assistant/script/repository/blue_amo/actions/stitch_the_frames.py
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
from typing import List
|
2
|
-
import numpy as np
|
3
|
-
import cv2
|
4
|
-
from tqdm import trange
|
5
|
-
|
6
|
-
from blueness import module
|
7
|
-
from blue_objects import file, objects
|
8
|
-
from blue_options import string
|
9
|
-
|
10
|
-
from blue_assistant import NAME
|
11
|
-
from blue_assistant.script.repository.base.classes import BaseScript
|
12
|
-
from blue_assistant.logger import logger
|
13
|
-
|
14
|
-
NAME = module.name(__file__, NAME)
|
15
|
-
|
16
|
-
|
17
|
-
def stitch_the_frames(
|
18
|
-
script: BaseScript,
|
19
|
-
node_name: str,
|
20
|
-
) -> bool:
|
21
|
-
list_of_frames_filenames: List[str] = [
|
22
|
-
filename
|
23
|
-
for filename in [
|
24
|
-
script.nodes[node_name_].get("filename", "")
|
25
|
-
for node_name_ in [
|
26
|
-
f"generating-frame-{index+1:03d}"
|
27
|
-
for index in range(script.vars["frame_count"])
|
28
|
-
]
|
29
|
-
]
|
30
|
-
if filename
|
31
|
-
]
|
32
|
-
if not list_of_frames_filenames:
|
33
|
-
return True
|
34
|
-
|
35
|
-
logger.info(
|
36
|
-
"{} frames to stitch: {}".format(
|
37
|
-
len(list_of_frames_filenames),
|
38
|
-
", ".join(list_of_frames_filenames),
|
39
|
-
)
|
40
|
-
)
|
41
|
-
|
42
|
-
list_of_frames: List[np.ndarray] = []
|
43
|
-
for filename in list_of_frames_filenames:
|
44
|
-
success, frame = file.load_image(
|
45
|
-
objects.path_of(
|
46
|
-
filename=filename,
|
47
|
-
object_name=script.object_name,
|
48
|
-
)
|
49
|
-
)
|
50
|
-
|
51
|
-
if success:
|
52
|
-
list_of_frames += [frame]
|
53
|
-
|
54
|
-
if not list_of_frames:
|
55
|
-
return True
|
56
|
-
|
57
|
-
common_height = list_of_frames[0].shape[0]
|
58
|
-
for index in trange(len(list_of_frames)):
|
59
|
-
if list_of_frames[index].shape[0] != common_height:
|
60
|
-
aspect_ratio = (
|
61
|
-
list_of_frames[index].shape[1] / list_of_frames[index].shape[0]
|
62
|
-
)
|
63
|
-
new_width = int(common_height * aspect_ratio)
|
64
|
-
|
65
|
-
list_of_frames[index] = cv2.resize(
|
66
|
-
list_of_frames[index],
|
67
|
-
(new_width, common_height),
|
68
|
-
interpolation=cv2.INTER_AREA,
|
69
|
-
)
|
70
|
-
|
71
|
-
full_frame = np.concatenate(list_of_frames, axis=1)
|
72
|
-
logger.info(f"full_frame: {string.pretty_shape_of_matrix(full_frame)}")
|
73
|
-
|
74
|
-
return file.save_image(
|
75
|
-
objects.path_of(
|
76
|
-
filename=f"{node_name}.png",
|
77
|
-
object_name=script.object_name,
|
78
|
-
),
|
79
|
-
full_frame,
|
80
|
-
log=True,
|
81
|
-
)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant/script/repository/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{blue_assistant-4.97.1 → blue_assistant-4.121.1}/blue_assistant.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|