Spaces:
Runtime error
Runtime error
huggingface
Browse files- README.md +12 -4
- config.py +3 -3
- crazy_functions/询问多个大语言模型.py +2 -2
- main.py +3 -2
README.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
| 2 |
-
|
| 3 |
-
# <img src="docs/logo.png" width="40" > ChatGPT 学术优化
|
| 4 |
|
| 5 |
**如果喜欢这个项目,请给它一个Star;如果你发明了更好用的快捷键或函数插件,欢迎发issue或者pull requests**
|
| 6 |
|
|
@@ -276,8 +286,6 @@ docker run --rm -it --net=host --gpus=all gpt-academic bash
|
|
| 276 |
- version 2.0: 引入模块化函数插件
|
| 277 |
- version 1.0: 基础功能
|
| 278 |
|
| 279 |
-
chatgpt_academic开发者QQ群:734063350
|
| 280 |
-
|
| 281 |
## 参考与学习
|
| 282 |
|
| 283 |
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: academic-chatgpt
|
| 3 |
+
emoji: 😻
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: blue
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 3.25.0
|
| 8 |
+
python_version: 3.11
|
| 9 |
+
app_file: main.py
|
| 10 |
+
pinned: false
|
| 11 |
+
---
|
| 12 |
|
| 13 |
+
# ChatGPT 学术优化
|
|
|
|
| 14 |
|
| 15 |
**如果喜欢这个项目,请给它一个Star;如果你发明了更好用的快捷键或函数插件,欢迎发issue或者pull requests**
|
| 16 |
|
|
|
|
| 286 |
- version 2.0: 引入模块化函数插件
|
| 287 |
- version 1.0: 基础功能
|
| 288 |
|
|
|
|
|
|
|
| 289 |
## 参考与学习
|
| 290 |
|
| 291 |
```
|
config.py
CHANGED
|
@@ -43,9 +43,9 @@ WEB_PORT = -1
|
|
| 43 |
# 如果OpenAI不响应(网络卡顿、代理失败、KEY失效),重试的次数限制
|
| 44 |
MAX_RETRY = 2
|
| 45 |
|
| 46 |
-
# OpenAI模型选择是(gpt4
|
| 47 |
-
LLM_MODEL = "gpt-3.5-turbo" # 可选
|
| 48 |
-
AVAIL_LLM_MODELS = ["gpt-3.5-turbo", "
|
| 49 |
|
| 50 |
# 本地LLM模型如ChatGLM的执行方式 CPU/GPU
|
| 51 |
LOCAL_MODEL_DEVICE = "cpu" # 可选 "cuda"
|
|
|
|
| 43 |
# 如果OpenAI不响应(网络卡顿、代理失败、KEY失效),重试的次数限制
|
| 44 |
MAX_RETRY = 2
|
| 45 |
|
| 46 |
+
# OpenAI模型选择是(gpt4现在只对申请成功的人开放)
|
| 47 |
+
LLM_MODEL = "gpt-3.5-turbo" # 可选 "chatglm"
|
| 48 |
+
AVAIL_LLM_MODELS = ["gpt-3.5-turbo", "gpt-4", "api2d-gpt-4", "api2d-gpt-3.5-turbo"]
|
| 49 |
|
| 50 |
# 本地LLM模型如ChatGLM的执行方式 CPU/GPU
|
| 51 |
LOCAL_MODEL_DEVICE = "cpu" # 可选 "cuda"
|
crazy_functions/询问多个大语言模型.py
CHANGED
|
@@ -13,11 +13,11 @@ def 同时问询(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt
|
|
| 13 |
web_port 当前软件运行的端口号
|
| 14 |
"""
|
| 15 |
history = [] # 清空历史,以免输入溢出
|
| 16 |
-
chatbot.append((txt, "正在同时咨询
|
| 17 |
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 # 由于请求gpt需要一段时间,我们先及时地做一次界面更新
|
| 18 |
|
| 19 |
# llm_kwargs['llm_model'] = 'chatglm&gpt-3.5-turbo&api2d-gpt-3.5-turbo' # 支持任意数量的llm接口,用&符号分隔
|
| 20 |
-
llm_kwargs['llm_model'] = '
|
| 21 |
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(
|
| 22 |
inputs=txt, inputs_show_user=txt,
|
| 23 |
llm_kwargs=llm_kwargs, chatbot=chatbot, history=history,
|
|
|
|
| 13 |
web_port 当前软件运行的端口号
|
| 14 |
"""
|
| 15 |
history = [] # 清空历史,以免输入溢出
|
| 16 |
+
chatbot.append((txt, "正在同时咨询gpt-3.5和gpt-4……"))
|
| 17 |
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 # 由于请求gpt需要一段时间,我们先及时地做一次界面更新
|
| 18 |
|
| 19 |
# llm_kwargs['llm_model'] = 'chatglm&gpt-3.5-turbo&api2d-gpt-3.5-turbo' # 支持任意数量的llm接口,用&符号分隔
|
| 20 |
+
llm_kwargs['llm_model'] = 'gpt-3.5-turbo&gpt-4' # 支持任意数量的llm接口,用&符号分隔
|
| 21 |
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(
|
| 22 |
inputs=txt, inputs_show_user=txt,
|
| 23 |
llm_kwargs=llm_kwargs, chatbot=chatbot, history=history,
|
main.py
CHANGED
|
@@ -53,6 +53,7 @@ def main():
|
|
| 53 |
cancel_handles = []
|
| 54 |
with gr.Blocks(title="ChatGPT 学术优化", theme=set_theme, analytics_enabled=False, css=advanced_css) as demo:
|
| 55 |
gr.HTML(title_html)
|
|
|
|
| 56 |
cookies = gr.State({'api_key': API_KEY, 'llm_model': LLM_MODEL})
|
| 57 |
with gr_L1():
|
| 58 |
with gr_L2(scale=2):
|
|
@@ -62,7 +63,7 @@ def main():
|
|
| 62 |
with gr_L2(scale=1):
|
| 63 |
with gr.Accordion("输入区", open=True) as area_input_primary:
|
| 64 |
with gr.Row():
|
| 65 |
-
txt = gr.Textbox(show_label=False, placeholder="
|
| 66 |
with gr.Row():
|
| 67 |
submitBtn = gr.Button("提交", variant="primary")
|
| 68 |
with gr.Row():
|
|
@@ -183,7 +184,7 @@ def main():
|
|
| 183 |
threading.Thread(target=warm_up_modules, name="warm-up", daemon=True).start()
|
| 184 |
|
| 185 |
auto_opentab_delay()
|
| 186 |
-
demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0",
|
| 187 |
|
| 188 |
if __name__ == "__main__":
|
| 189 |
main()
|
|
|
|
| 53 |
cancel_handles = []
|
| 54 |
with gr.Blocks(title="ChatGPT 学术优化", theme=set_theme, analytics_enabled=False, css=advanced_css) as demo:
|
| 55 |
gr.HTML(title_html)
|
| 56 |
+
gr.HTML('''<center><a href="https://huggingface.co/spaces/qingxu98/gpt-academic?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>请您打开此页面后务必点击上方的“复制空间”(Duplicate Space)按钮!<font color="#FF00FF">使用时,先在输入框填入API-KEY然后回车。</font><br/>切忌在“复制空间”(Duplicate Space)之前填入API_KEY或进行提问,否则您的API_KEY将极可能被空间所有者攫取!<br/>支持任意数量的OpenAI的密钥和API2D的密钥共存,例如输入"OpenAI密钥1,API2D密钥2",然后提交,即可同时使用两种模型接口。</center>''')
|
| 57 |
cookies = gr.State({'api_key': API_KEY, 'llm_model': LLM_MODEL})
|
| 58 |
with gr_L1():
|
| 59 |
with gr_L2(scale=2):
|
|
|
|
| 63 |
with gr_L2(scale=1):
|
| 64 |
with gr.Accordion("输入区", open=True) as area_input_primary:
|
| 65 |
with gr.Row():
|
| 66 |
+
txt = gr.Textbox(show_label=False, lines=2, placeholder="输入问题或API密钥,输入多个密钥时,用英文逗号间隔。支持OpenAI密钥和API2D密钥共存。").style(container=False)
|
| 67 |
with gr.Row():
|
| 68 |
submitBtn = gr.Button("提交", variant="primary")
|
| 69 |
with gr.Row():
|
|
|
|
| 184 |
threading.Thread(target=warm_up_modules, name="warm-up", daemon=True).start()
|
| 185 |
|
| 186 |
auto_opentab_delay()
|
| 187 |
+
demo.queue(concurrency_count=CONCURRENT_COUNT).launch(server_name="0.0.0.0", share=False, favicon_path="docs/logo.png")
|
| 188 |
|
| 189 |
if __name__ == "__main__":
|
| 190 |
main()
|