Spaces:
Runtime error
Runtime error
Merge pull request #727 from CSUMaVeRick/master
Browse files分享一个参考文献条目转换为BibTex的自定义函数 Share a function that can transform bibliography items into BibTex style
- .gitignore +2 -1
- core_functional.py +7 -0
- main.py +2 -0
.gitignore
CHANGED
@@ -146,4 +146,5 @@ debug*
|
|
146 |
private*
|
147 |
crazy_functions/test_project/pdf_and_word
|
148 |
crazy_functions/test_samples
|
149 |
-
request_llm/jittorllms
|
|
|
|
146 |
private*
|
147 |
crazy_functions/test_project/pdf_and_word
|
148 |
crazy_functions/test_samples
|
149 |
+
request_llm/jittorllms
|
150 |
+
request_llm/moss
|
core_functional.py
CHANGED
@@ -68,4 +68,11 @@ def get_core_functions():
|
|
68 |
"Prefix": r"请解释以下代码:" + "\n```\n",
|
69 |
"Suffix": "\n```\n",
|
70 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
|
|
68 |
"Prefix": r"请解释以下代码:" + "\n```\n",
|
69 |
"Suffix": "\n```\n",
|
70 |
},
|
71 |
+
"参考文献转Bib": {
|
72 |
+
"Prefix": r"Here are some bibliography items, please transform them into bibtex style." +
|
73 |
+
r"Note that, reference styles maybe more than one kind, you should transform each item correctly." +
|
74 |
+
r"Items need to be transformed:",
|
75 |
+
"Suffix": r"",
|
76 |
+
"Visible": False,
|
77 |
+
}
|
78 |
}
|
main.py
CHANGED
@@ -74,6 +74,7 @@ def main():
|
|
74 |
with gr.Accordion("基础功能区", open=True) as area_basic_fn:
|
75 |
with gr.Row():
|
76 |
for k in functional:
|
|
|
77 |
variant = functional[k]["Color"] if "Color" in functional[k] else "secondary"
|
78 |
functional[k]["Button"] = gr.Button(k, variant=variant)
|
79 |
with gr.Accordion("函数插件区", open=True) as area_crazy_fn:
|
@@ -144,6 +145,7 @@ def main():
|
|
144 |
clearBtn2.click(lambda: ("",""), None, [txt, txt2])
|
145 |
# 基础功能区的回调函数注册
|
146 |
for k in functional:
|
|
|
147 |
click_handle = functional[k]["Button"].click(fn=ArgsGeneralWrapper(predict), inputs=[*input_combo, gr.State(True), gr.State(k)], outputs=output_combo)
|
148 |
cancel_handles.append(click_handle)
|
149 |
# 文件上传区,接收文件后与chatbot的互动
|
|
|
74 |
with gr.Accordion("基础功能区", open=True) as area_basic_fn:
|
75 |
with gr.Row():
|
76 |
for k in functional:
|
77 |
+
if ("Visible" in functional[k]) and (not functional[k]["Visible"]): continue
|
78 |
variant = functional[k]["Color"] if "Color" in functional[k] else "secondary"
|
79 |
functional[k]["Button"] = gr.Button(k, variant=variant)
|
80 |
with gr.Accordion("函数插件区", open=True) as area_crazy_fn:
|
|
|
145 |
clearBtn2.click(lambda: ("",""), None, [txt, txt2])
|
146 |
# 基础功能区的回调函数注册
|
147 |
for k in functional:
|
148 |
+
if ("Visible" in functional[k]) and (not functional[k]["Visible"]): continue
|
149 |
click_handle = functional[k]["Button"].click(fn=ArgsGeneralWrapper(predict), inputs=[*input_combo, gr.State(True), gr.State(k)], outputs=output_combo)
|
150 |
cancel_handles.append(click_handle)
|
151 |
# 文件上传区,接收文件后与chatbot的互动
|