一个JupyterLab扩展,它添加了DALL-E模型引擎和图像插入模式。
项目描述
jupyter_ai_dalle
此扩展由名为 jupyter_ai_dalle
的Python包组成,该包将模型引擎暴露给Jupyter AI服务器扩展,以及一个名为 jupyter_ai_dalle
的NPM包,该包提供前端labextension注册插入器。
要求
- JupyterLab >= 3.0
安装
要安装扩展,请执行
pip install jupyter_ai_dalle
卸载
要删除扩展,请执行
pip uninstall jupyter_ai_dalle
贡献
开发安装
注意:您需要NodeJS来构建扩展包。
jlpm
命令是JupyterLab的yarn的固定版本,它随JupyterLab一起安装。您可以使用以下命令中的yarn
或npm
代替jlpm
。
# Clone the repo to your local environment
# Change directory to the jupyter_ai_dalle directory
# Install package in development mode
pip install -e ".[test]"
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm build
您可以在不同的终端中同时监视源目录并运行JupyterLab,以监视扩展源的变化并自动重新构建扩展。
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm watch
# Run JupyterLab in another terminal
jupyter lab
在运行监视命令的情况下,每次保存的更改都会立即在本地上构建并提供给您运行的JupyterLab。刷新JupyterLab以在浏览器中加载更改(您可能需要等待几秒钟以重新构建扩展)。
默认情况下,jlpm build
命令为该扩展生成源映射,以便更容易使用浏览器开发者工具进行调试。要为JupyterLab核心扩展也生成源映射,请运行以下命令
jupyter lab build --minimize=False
开发卸载
pip uninstall jupyter_ai_dalle
在开发模式下,您还需要删除由 jupyter labextension develop
命令创建的符号链接。要找到其位置,您可以运行 jupyter labextension list
来确定 labextensions
文件夹的位置。然后您可以在该文件夹中删除名为 jupyter_ai_dalle
的符号链接。
测试扩展
后端测试
此 AI 模块使用 Pytest 进行 Python 代码测试。
安装测试依赖项(只需安装一次)
pip install -e ".[test]"
# Each time you install the Python package, you need to restore the front-end extension link
jupyter labextension develop . --overwrite
要执行它们,请运行
pytest -vv -r ap --cov jupyter_ai_dalle
前端测试
此扩展使用 Jest 进行 JavaScript 代码测试。
要执行它们,请执行
jlpm
jlpm test
集成测试
此扩展使用 Playwright 进行集成测试(也称为用户级测试)。更精确地说,JupyterLab 辅助工具 Galata 用于在 JupyterLab 中测试扩展。
更多详细信息请参阅 ui-tests 的 README 文件。
打包扩展
参见 RELEASE
项目详情
下载文件
下载您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。