MOSS icon indicating copy to clipboard operation
MOSS copied to clipboard

gradio网页demo的问答出现<p>字符

Open BUPTccy opened this issue 1 year ago • 2 comments

想请问下网页的QA会带有<p>xxx</p>,哪怕在parse_text()中去除掉<p> 后台不显示<p>,网页输入输出也仍然显示该字符,应该如何解决呢 image

image

BUPTccy avatar Apr 26 '23 09:04 BUPTccy

def postprocess(self, y):
    if y is None:
        return []
    for i, (message, response) in enumerate(y):
        y[i] = (
            None if message is None else mdtex2html.convert((message)),
            None if response is None else mdtex2html.convert(response),
        )
    return y


gr.Chatbot.postprocess = postprocess

应该和后处理对文本进行渲染有关,需要在这里进行处理才有用

PanQiWei avatar Apr 26 '23 10:04 PanQiWei