Add uie python example and doc (#221)

* add fastdeploy.text.UIEModel

* Add uie python example

* Add one schema for cpp demo

* Add ConvertUIEResultToDict for pretty the uie result in python

* remove default args for SchemaNode

* Add uie example args

* Add uie python api desc

* Add infer.py usage

* truncate some example output

* Add uie schema usage

* Add uie result md

* Add uie c++ api doc
This commit is contained in:
Jack Zhou
2022-09-15 06:06:40 +08:00
committed by GitHub
parent fb0a428c3c
commit 14ba9ce6c2
11 changed files with 760 additions and 33 deletions

View File

@@ -71,7 +71,7 @@ int main(int argc, char* argv[]) {
auto predictor =
fastdeploy::text::UIEModel(model_path, param_path, vocab_path, 0.5, 128,
{"时间", "选手", "赛事名称"}, option);
fastdeploy::FDINFO << "After init predictor" << std::endl;
std::cout << "After init predictor" << std::endl;
std::vector<std::unordered_map<std::string, std::vector<UIEResult>>> results;
// Named Entity Recognition
predictor.Predict({"2月8日上午北京冬奥会自由式滑雪女子大跳台决赛中中国选手谷"
@@ -80,6 +80,16 @@ int main(int argc, char* argv[]) {
std::cout << results << std::endl;
results.clear();
predictor.SetSchema(
{"肿瘤的大小", "肿瘤的个数", "肝癌级别", "脉管内癌栓分级"});
predictor.Predict({"右肝肿瘤肝细胞性肝癌II-"
"III级梁索型和假腺管型肿瘤包膜不完整紧邻肝被膜"
"及周围肝组织未见脉管内癌栓MVI分级M0级及卫星子灶形"
"成。肿物1个大小4.2×4.0×2.8cm)。"},
&results);
std::cout << results << std::endl;
results.clear();
// Relation Extraction
predictor.SetSchema(
{SchemaNode("竞赛名称", {SchemaNode("主办方"), SchemaNode("承办方"),