关系抽取、事件抽取、评论观点抽取、快递单信息抽取、上市公司信息抽取、情感分类、命名实体识别。
import gradio as gr
from paddlenlp import Taskflow
schema = ['时间', '选手', '赛事名称']
ie = Taskflow('information_extraction', schema=schema)
# UGC: Define the inference fn() for your models
def model_inference(schema, text):
ie.set_schema(eval(schema))
res = ie(text)
json_out = {"text": text, "result": res}
return json_out
def clear_all():
return None, None, None
with gr.Blocks() as demo:
gr.Markdown("ERNIE-UIE")
with gr.Column(scale=1, min_width=100):
schema = gr.Textbox(
placeholder="['时间', '选手', '赛事名称']",
label="输入结构:",
lines=2)
text = gr.Textbox(
placeholder="2月8日上午北京冬奥会自由式滑雪女子大跳台决赛中中国选手谷爱凌以188.25分获得金牌!",
label="输入内