diff --git a/functional.py b/functional.py index b1f7ae9..56d98fe 100644 --- a/functional.py +++ b/functional.py @@ -21,12 +21,20 @@ def get_functionals(): "Suffix": r"", }, "查找语法错误": { - "Prefix": r"Below is a paragraph from an academic paper. " + - r"Can you help me ensure that the grammar and the spelling is correct? " + - r"Do not try to polish the text, if no mistake is found, tell me that this paragraph is good." + - r"If you find grammar or spelling mistakes, please list mistakes you find in a two-column markdown table, " + + "Prefix": r"Can you help me ensure that the grammar and the spelling is correct? " + + r"Do not try to polish the text, if no mistake is found, tell me that this paragraph is good." + + r"If you find grammar or spelling mistakes, please list mistakes you find in a two-column markdown table, " + r"put the original text the first column, " + - r"put the corrected text in the second column and highlight the key words you fixed." + "\n\n", + r"put the corrected text in the second column and highlight the key words you fixed.""\n" + r"Example:""\n" + r"Paragraph: How is you? Do you knows what is it?""\n" + r"| Original sentence | Corrected sentence |""\n" + r"| :--- | :--- |""\n" + r"| How **is** you? | How **are** you? |""\n" + r"| Do you **knows** what **is** **it**? | Do you **know** what **it** **is** ? |""\n" + r"Below is a paragraph from an academic paper. " + r"You need to report all grammar and spelling mistakes as the example before." + + "\n\n", "Suffix": r"", "PreProcess": clear_line_break, # 预处理:清除换行符 }, diff --git a/main.py b/main.py index cdcfaa4..23f848b 100644 --- a/main.py +++ b/main.py @@ -36,8 +36,20 @@ gr.Chatbot.postprocess = format_io from theme import adjust_theme set_theme = adjust_theme() +CSS = """ +.markdown-body table { + border: 1px solid #ddd; + border-collapse: collapse; +} + +.markdown-body th, .markdown-body td { + border: 1px solid #ddd; + padding: 5px; +} +""" + cancel_handles = [] -with gr.Blocks(theme=set_theme, analytics_enabled=False) as demo: +with gr.Blocks(theme=set_theme, analytics_enabled=False, css=CSS) as demo: gr.HTML(title_html) with gr.Row().style(equal_height=True): with gr.Column(scale=2): diff --git a/toolbox.py b/toolbox.py index bf88760..6c48cbb 100644 --- a/toolbox.py +++ b/toolbox.py @@ -157,11 +157,12 @@ def markdown_convertion(txt): """ 将Markdown格式的文本转换为HTML格式。如果包含数学公式,则先将公式转换为HTML格式。 """ + pre = '