binary-husky / gpt_academic

为GPT/GLM等LLM大语言模型提供实用化交互接口,特别优化论文阅读/润色/写作体验,模块化设计,支持自定义快捷按钮&函数插件,支持Python和C++等项目剖析&自译解功能,PDF/LaTex论文翻译&总结功能,支持并行问询多种LLM模型,支持chatglm3等本地模型。接入通义千问, deepseekcoder, 讯飞星火, 文心一言, llama2, rwkv, claude2, moss等。
https://github.com/binary-husky/gpt_academic/wiki/online
GNU General Public License v3.0
65.7k stars 8.07k forks source link

[Bug]: 英语学术润色部分,包含markdown格式的公式会报错 #1511

Open RonghaiHe opened 9 months ago

RonghaiHe commented 9 months ago

Installation Method | 安装方法与平台

Pip Install (I used latest requirements.txt)

Version | 版本

Latest | 最新版

OS | 操作系统

Windows

Describe the bug | 简述

使用【英语学术润色】功能,若一段文字包含markdown格式的公式,如

Equation $E=mc^2$

会报错,Traceback见下方。

Screen Shot | 有帮助的截图

--

Terminal Traceback & Material to Help Reproduce Bugs | 终端traceback(如有) + 帮助我们复现的测试材料样本(如有)

Traceback (most recent call last): File "E:\anaconda3\lib\site-packages\gradio\routes.py", line 422, in run_predict output = await app.get_blocks().process_api( File "E:\anaconda3\lib\site-packages\gradio\blocks.py", line 1326, in process_api data = self.postprocess_data(fn_index, result["prediction"], state) File "E:\anaconda3\lib\site-packages\gradio\blocks.py", line 1260, in postprocess_data prediction_value = block.postprocess(prediction_value) File "E:\gpt_academic-master\gpt_academic-master\shared_utils\advanced_markdown_format.py", line 285, in format_io None if gpt_reply is None else markdown_convertion(gpt_reply) File "E:\gpt_academic-master\gpt_academic-master\shared_utils\advanced_markdown_format.py", line 233, in markdown_convertion convert_stage_1 = markdown.markdown(text=txt, extensions=['sane_lists', 'tables', 'mdx_math', 'pymdownx.superfences', 'pymdownx.highlight'], File "E:\anaconda3\lib\site-packages\markdown\core.py", line 377, in markdown return md.convert(text) File "E:\anaconda3\lib\site-packages\markdown\core.py", line 258, in convert newRoot = treeprocessor.run(root) File "E:\anaconda3\lib\site-packages\markdown\treeprocessors.py", line 393, in run element.insert(i, newChild) File "E:\anaconda3\lib\xml\etree\ElementTree.py", line 252, in insert self._assert_is_element(subelement) File "E:\anaconda3\lib\xml\etree\ElementTree.py", line 259, in _assert_is_element raise TypeError('expected an Element, not %s' % type(e).name) TypeError: expected an Element, not Element

binary-husky commented 9 months ago

好奇怪啊,我复现不了

RonghaiHe commented 9 months ago

截图

RonghaiHe commented 9 months ago

还有一个警告信息我没有附上,不知道是否相关:

E:\anaconda3\lib\site-packages\pandas\core\computation\expressions.py:20: UserWarning: Pandas requires version '2.7.3' or newer of 'numexpr' (version '2.7.1' currently installed).
  from pandas.core.computation.check import NUMEXPR_INSTALLED