MindSearch介绍
部署到hugging-face
根据教程整理文件后上传,报错
runtime error
Exit code: 1. Reason: Traceback (most recent call last):
File "/home/user/app/app.py", line 6, in <module>
from lagent.schema import AgentStatusCode
File "/usr/local/lib/python3.10/site-packages/lagent/__init__.py", line 2, in <module>
from .actions import * # noqa: F401, F403
File "/usr/local/lib/python3.10/site-packages/lagent/actions/__init__.py", line 3, in <module>
from .action_executor import ActionExecutor
File "/usr/local/lib/python3.10/site-packages/lagent/actions/action_executor.py", line 4, in <module>
from .base_action import BaseAction
File "/usr/local/lib/python3.10/site-packages/lagent/actions/base_action.py", line 14, in <module>
from class_registry import AutoRegister, ClassRegistry
ImportError: cannot import name 'AutoRegister' from 'class_registry' (/usr/local/lib/python3.10/site-packages/class_registry/__init__.py)
在requirements中添加一行class_registry依赖:
duckduckgo_search==5.3.1b1
einops
fastapi
git+https://github.com/InternLM/lagent.git
gradio
janus
lmdeploy
pyvis
sse-starlette
termcolor
transformers==4.41.0
uvicorn
class_registry
成功部署
美化gradio页面
原先的页面比较朴素,而且搜索内容靠下,也很难输入。
这里我们简单调整下布局,把输入提前,然后更换一个gradio主题。
seafoam = gr.Theme.from_hub("NoCrypt/miku")
with gr.Blocks(theme=seafoam, js=js) as demo:
gr.HTML("""<h1 align="center" style="color: blue">MindSearch Gradio Demo</h1>""")
gr.HTML("""<p style="text-align: center; font-family: Arial, sans-serif;">MindSearch is an open-source AI Search Engine Framework with Perplexity.ai Pro performance. You can deploy your own Perplexity.ai-style search engine using either closed-source LLMs (GPT, Claude) or open-source LLMs (InternLM2.5-7b-chat).</p>""")
gr.HTML("""
<div style="text-align: center; font-size: 16px;">
<a href="https://github.com/InternLM/MindSearch" style="margin-right: 15px; text-decoration: none; color: #4A90E2;">�� GitHub</a>
<a href="https://arxiv.org/abs/2407.20183" style="margin-right: 15px; text-decoration: none; color: #4A90E2;">📄 Arxiv</a>
<a href="https://huggingface.co/papers/2407.20183" style="margin-right: 15px; text-decoration: none; color: #4A90E2;">📚 Hugging Face Papers</a>
<a href="https://huggingface.co/spaces/internlm/MindSearch" style="text-decoration: none; color: #4A90E2;">🤗 Hugging Face Demo</a>
</div>
""")
with gr.Row():
with gr.Column(scale=10):
with gr.Row():
with gr.Column(scale=4):
user_input = gr.Textbox(show_label=False,
placeholder='帮我搜索一下 InternLM 开源体系',
lines=5,
container=False)
with gr.Column(scale=1):
with gr.Row():
submitBtn = gr.Button('Submit')
with gr.Row():
emptyBtn = gr.Button('Clear History')
with gr.Row():
with gr.Column():
planner = gr.Chatbot(label='planner',
height=700,
show_label=True,
show_copy_button=True,
bubble_full_width=False,
render_markdown=True)
with gr.Column():
searcher = gr.Chatbot(label='searcher',
height=700,
show_label=True,
show_copy_button=True,
bubble_full_width=False,
render_markdown=True)
更改后的结果如下: