-
Notifications
You must be signed in to change notification settings - Fork 0
/
component-transform-string-to-emoji.yaml
44 lines (39 loc) · 1.34 KB
/
component-transform-string-to-emoji.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Emoji
inputs:
- {name: text, type: String}
outputs:
- {name: emoji_text, type: String}
- {name: emoji, type: String}
implementation:
container:
image: python:3.7
command:
- sh
- -c
- |2
if ! [ -x "$(command -v pip)" ]; then
python3 -m ensurepip || python3 -m ensurepip --user || apt-get install python3-pip
fi
PIP_DISABLE_PIP_VERSION_CHECK=1 python3 -m pip install --quiet --no-warn-script-location 'emoji' 'kfp==1.8.9' && "$0" "$@"
- sh
- -ec
- |
program_path=$(mktemp -d)
printf "%s" "$0" > "$program_path/ephemeral_component.py"
python3 -m kfp.v2.components.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@"
- |2+
import kfp
from kfp.v2 import dsl
from kfp.v2.dsl import *
from typing import *
def emoji(text: str,) -> NamedTuple("Outputs", [("emoji_text", str), ("emoji", str),],):
import emoji
emoji_text = text
emoji_str = emoji.emojize(':' + emoji_text + ':', use_aliases=True)
print("output one: {}; output_two: {}".format(emoji_text, emoji_str))
return (emoji_text, emoji_str)
args:
- --executor_input
- {executorInput: null}
- --function_to_execute
- emoji