You've already forked DataMate
feature: deer-flow支持从datamate获取外部接入模型 (#83)
* feature: deer-flow支持从datamate获取外部接入模型
This commit is contained in:
6
runtime/ops/examples/test_operator/__init__.py
Normal file
6
runtime/ops/examples/test_operator/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from datamate.core.base_op import OPERATORS
|
||||
|
||||
OPERATORS.register_module(module_name='TestMapper',
|
||||
module_path="ops.user.test_operator.process")
|
||||
85
runtime/ops/examples/test_operator/metadata.yml
Normal file
85
runtime/ops/examples/test_operator/metadata.yml
Normal file
@@ -0,0 +1,85 @@
|
||||
name: '测试算子'
|
||||
description: '这是一个测试算子。'
|
||||
language: 'python'
|
||||
vendor: 'huawei'
|
||||
raw_id: 'TestMapper'
|
||||
version: '1.0.0'
|
||||
modal: 'text'
|
||||
effect:
|
||||
before: '使用方式很简单,只需要将代码放入Markdown文本中即可,富文本格式可直接复制表情😀使用。'
|
||||
after: '使用方式很简单,只需要将代码放入Markdown文本中即可,富文本格式可直接复制表情使用。'
|
||||
inputs: 'text'
|
||||
outputs: 'text'
|
||||
settings:
|
||||
sliderTest:
|
||||
name: '滑窗测试'
|
||||
description: '这是一个测试滑窗。'
|
||||
type: 'slider'
|
||||
defaultVal: 0.5
|
||||
min: 0
|
||||
max: 1
|
||||
step: 0.1
|
||||
switchTest:
|
||||
name: '开关测试'
|
||||
description: '这是一个开关测试。'
|
||||
type: 'switch'
|
||||
defaultVal: 'true'
|
||||
required: false
|
||||
checkedLabel: '选中'
|
||||
unCheckedLabel: '未选中'
|
||||
radioTest:
|
||||
name: '单选测试'
|
||||
description: '这是一个单选测试。'
|
||||
type: 'radio'
|
||||
defaultVal: 'option1'
|
||||
required: false
|
||||
options:
|
||||
- label: '选项1'
|
||||
value: 'option1'
|
||||
- label: '选项2'
|
||||
value: 'option2'
|
||||
selectTest:
|
||||
name: '下拉框测试'
|
||||
description: '这是一个下拉框测试。'
|
||||
type: 'select'
|
||||
defaultVal: 'option1'
|
||||
required: false
|
||||
options:
|
||||
- label: '选项1'
|
||||
value: 'option1'
|
||||
- label: '选项2'
|
||||
value: 'option2'
|
||||
rangeTest:
|
||||
name: '范围测试'
|
||||
description: '这是一个范围框测试。'
|
||||
type: 'range'
|
||||
properties:
|
||||
- name: 'rangeLeft'
|
||||
type: 'inputNumber'
|
||||
defaultVal: 100
|
||||
min: 0
|
||||
max: 10000
|
||||
step: 1
|
||||
- name: 'rangeRight'
|
||||
type: 'inputNumber'
|
||||
defaultVal: 8000
|
||||
min: 0
|
||||
max: 10000
|
||||
step: 1
|
||||
checkboxTest:
|
||||
name: '多选框测试'
|
||||
description: '这是一个多选框测试。'
|
||||
type: 'checkbox'
|
||||
defaultVal: 'option1,option2'
|
||||
required: false
|
||||
options:
|
||||
- label: '选项1'
|
||||
value: 'option1'
|
||||
- label: '选项2'
|
||||
value: 'option2'
|
||||
inputTest:
|
||||
name: '输入框测试'
|
||||
description: '这是一个输入框测试。'
|
||||
type: 'input'
|
||||
defaultVal: 'Test Input'
|
||||
required: false
|
||||
10
runtime/ops/examples/test_operator/process.py
Normal file
10
runtime/ops/examples/test_operator/process.py
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
from typing import Dict, Any
|
||||
|
||||
from datamate.core.base_op import Mapper
|
||||
|
||||
|
||||
class TestMapper(Mapper):
|
||||
def execute(self, sample: Dict[str, Any]) -> Dict[str, Any]:
|
||||
sample[self.text_key] += "\n####################\n"
|
||||
return sample
|
||||
Reference in New Issue
Block a user