提交 c8193062 编写于 作者: W wuzewu

add TEXT type support

上级 fb0e8026
...@@ -65,6 +65,8 @@ class DataType(Enum): ...@@ -65,6 +65,8 @@ class DataType(Enum):
if data_type == DataType.IMAGE: if data_type == DataType.IMAGE:
return ImageReader return ImageReader
elif data_type == DataType.TEXT:
return TextReader
else: else:
type_str = DataType.str(data_type) type_str = DataType.str(data_type)
logger.critical( logger.critical(
...@@ -78,3 +80,9 @@ class ImageReader: ...@@ -78,3 +80,9 @@ class ImageReader:
utils.check_path(path) utils.check_path(path)
image = Image.open(path) image = Image.open(path)
return image return image
class TextReader:
@classmethod
def read(cls, text):
return text
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册