Spaces:
Sleeping
Sleeping
from modelscope.utils.constant import Tasks | |
from .pipeline_tool import ModelscopePipelineTool | |
class TextAddressTool(ModelscopePipelineTool): | |
default_model = 'damo/mgeo_geographic_elements_tagging_chinese_base' | |
description = '地址解析服务,针对中文地址信息,识别出里面的元素,包括省、市、区、镇、社区、道路、路号、POI、楼栋号、户室号等' | |
name = 'modelscope_text-address' | |
parameters: list = [{ | |
'name': 'input', | |
'description': '用户输入的地址信息', | |
'required': True | |
}] | |
task = Tasks.token_classification | |
def _parse_output(self, origin_result, *args, **kwargs): | |
final_result = {} | |
for e in origin_result['output']: | |
final_result[e['type']] = e['span'] | |
return {'result': final_result} | |