Skip to content

Commit

Permalink
Update readme to match the recent changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hv0905 committed Jul 5, 2024
1 parent 2f0b3c5 commit ea4976b
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 41 deletions.
2 changes: 1 addition & 1 deletion docker-compose-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
# dockerfile: cpu-only.Dockerfile
image: edgeneko/neko-image-gallery:latest-cpu
ports:
- "127.0.0.1:8000:8000"
- "8000:8000"
volumes:
- "./static:/opt/NekoImageGallery/static"
environment:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
# dockerfile: Dockerfile
image: edgeneko/neko-image-gallery:latest
ports:
- "127.0.0.1:8000:8000"
- "8000:8000"
volumes:
- "./static:/opt/NekoImageGallery/static"
environment:
Expand Down
30 changes: 13 additions & 17 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,14 @@ Local file storage does not require an additional database deployment process, b
```
5. Modify the project configuration file inside `config/`, you can edit `default.env` directly, but it's recommended to
create a new file named `local.env` and override the configuration in `default.env`.
6. ~~Initialize the Qdrant database by running the following command:~~
Since NekoImageGallery will now automatically create the collection if not present, this steps is no longer required.
However, if you want to explicitly create the collection, you can still run the following command:
```shell
python main.py --init-database
```
This operation will create a collection in the Qdrant database with the same name as `config.QDRANT_COLL` to store
image vectors.
7. Run this application:
6. Run this application:
```shell
python main.py
```
You can use `--host` to specify the IP address you want to bind to (default is 0.0.0.0) and `--port` to specify the
port you want to bind to (default is 8000).
8. (Optional) Deploy the front-end application: [NekoImageGallery.App](https://github.com/hv0905/NekoImageGallery.App)
port you want to bind to (default is 8000).
You can see all available commands and options by running `python main.py --help`.
7. (Optional) Deploy the front-end application: [NekoImageGallery.App](https://github.com/hv0905/NekoImageGallery.App)
is a simple web front-end application for this project. If you want to deploy it, please refer to
its [deployment documentation](https://github.com/hv0905/NekoImageGallery.App).
Expand Down Expand Up @@ -160,19 +153,22 @@ the [official documentation](https://docs.docker.com/config/containers/resource_
There are serval ways to upload images to NekoImageGallery
- Through the web interface: You can use the web interface to upload images to the server. The web interface is provided
by [NekoImageGallery.App](https://github.com/hv0905/NekoImageGallery.App). Make sure you have enabled the **Admin API
** and set your **Admin Token** in the configuration file.
by [NekoImageGallery.App](https://github.com/hv0905/NekoImageGallery.App). Make sure you have enabled the
**Admin API** and set your **Admin Token** in the configuration file.
- Through local indexing: This is suitable for local deployment or when the images you want to upload are already on the
server.
Use the following command to index your local image directory:
```shell
python main.py --local-index <path-to-your-image-directory>
python main.py local-index <path-to-your-image-directory>
```
The above command will recursively upload all images in the specified directory and its subdirectories to the server.
- Through the API: You can use the upload API provided by NekoImageGallery to upload images.
Make sure you have enabled the **Admin API** and set your **Admin Token** in the configuration file.
This method is suitable for automated image uploading. Checkout [API documentation](#-api-documentation) for more
You can also specify categories/starred for images you upload, see `python main.py local-index --help` for more
information.
- Through the API: You can use the upload API provided by NekoImageGallery to upload images. By using this method, the
server can prevent saving the image files locally but only store their URLs and metadata.
Make sure you have enabled the **Admin API** and set your **Admin Token** in the configuration file.
This method is suitable for automated image uploading or sync NekoImageGallery with external systems.
Checkout [API documentation](#-api-documentation) for more information.
## 📚 API Documentation
Expand Down
45 changes: 23 additions & 22 deletions readme_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,13 @@ NekoImageGallery支持两种元数据存储方式:Qdrant数据库存储与本
```
5. 按需修改位于`config`目录下的配置文件,您可以直接修改`default.env`,但是建议创建一个名为`local.env`
的文件,覆盖`default.env`中的配置。
6. ~~初始化Qdrant数据库,运行下面命令:~~ 由于NekoImageGallery会自动在第一次运行时初始化Qdrant数据库,因此此步骤可省略。但您仍可通过以下命令显式初始化Qdrant数据库:
```shell
python main.py --init-database
```
此操作将会在Qdrant数据库中创建一个名字与`config.QDRANT_COLL`相同的collection,用于存储图片向量。
7. (可选)在开发部署与小规模部署中,可以使用本应用自带的静态文件索引与服务功能。使用下面命令索引您本地的图片目录:
```shell
python main.py --local-index <path-to-your-image-directory>
```
此操作会将位于`<path-to-your-image-directory>`目录下的所有图片文件复制到`config.STATIC_FILE_PATH`目录下(
默认为`./static`),并将图片信息写入Qdrant数据库。

然后运行下面的命令,为所有static目录下的图片生成缩略图:

```shell
python main.py --local-create-thumbnail
```

如果你希望大规模部署,可以使用类似`MinIO`的OSS存储服务,将图片文件存储在OSS中,然后将图片信息写入Qdrant数据库即可。
8. 运行本应用:
6. 运行本应用:
```shell
python main.py
```
你可以通过`--host`指定希望绑定到的ip地址(默认为0.0.0.0),通过`--port`指定希望绑定到的端口(默认为8000)。
9. (可选)部署前端应用:[NekoImageGallery.App](https://github.com/hv0905/NekoImageGallery.App)
你可以通过`--host`指定希望绑定到的ip地址(默认为0.0.0.0),通过`--port`指定希望绑定到的端口(默认为8000)。
通过`python main.py --help`可以查看所有可用命令和选项。
7. (可选)部署前端应用:[NekoImageGallery.App](https://github.com/hv0905/NekoImageGallery.App)
是本项目的一个简易web前端应用,如需部署请参照它的[部署文档](https://github.com/hv0905/NekoImageGallery.App)。

### 🐋 Docker 部署
Expand Down Expand Up @@ -153,6 +135,25 @@ NekoImageGallery镜像发布在DockerHub上,并包含多个变种,设计于
docker compose up -d
```

### 将图片上传至NekoImageGallery

有几种方法可以将图片上传至NekoImageGallery:

-
通过网页界面:您可以使用网页界面将图片上传到服务器。网页界面由 [NekoImageGallery.App](https://github.com/hv0905/NekoImageGallery.App)
提供。请确保您已启用 **Admin API** 并在配置文件中设置了您的 **Admin Token**
- 通过本地索引:这适用于本地部署或当您想上传的图片已经在服务器上时。
使用以下命令来索引您的本地图片目录:
```shell
python main.py local-index <path-to-your-image-directory>
```
上述命令将递归地将指定目录及其子目录中的所有图片上传到服务器。
你可以通过附加选项指定上传的图片的类别和星标状态,具体参考`python main.py local-index --help`
-
通过API:您可以使用NekoImageGallery提供的上传API来上传图片。通过此方法,可允许服务器本地不保存图片文件而仅仅存储其URL以及元数据。
请确保您已启用 **Admin API** 并在配置文件中设置了您的 **Admin Token**
此方法适用于自动化图片上传或将NekoImageGallery与外部系统进行同步。更多信息请查看 [API文档](#-api文档)。

## 📚 API文档

API文档由FastAPI内置的Swagger UI提供。您可以通过访问服务器的`/docs``/redoc`路径来查看API文档。
Expand Down

0 comments on commit ea4976b

Please sign in to comment.