Refactor DocSum example (#1286)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Sihan Chen
2024-12-26 14:45:17 +08:00
committed by GitHub
parent 6b6a08df78
commit a01729a5c2
16 changed files with 145 additions and 1143 deletions

View File

@@ -29,30 +29,6 @@ The Whisper Service converts audio files to text. Follow these steps to build an
docker build -t opea/whisper:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/asr/whisper/dependency/Dockerfile .
```
#### Audio to text Service
The Audio to text Service is another service for converting audio to text. Follow these steps to build and run the service:
```bash
docker build -t opea/dataprep-audio2text:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/multimedia2text/audio2text/Dockerfile .
```
#### Video to Audio Service
The Video to Audio Service extracts audio from video files. Follow these steps to build and run the service:
```bash
docker build -t opea/dataprep-video2audio:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/multimedia2text/video2audio/Dockerfile .
```
#### Multimedia to Text Service
The Multimedia to Text Service transforms multimedia data to text data. Follow these steps to build and run the service:
```bash
docker build -t opea/dataprep-multimedia2text:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/multimedia2text/Dockerfile .
```
### 2. Build MegaService Docker Image
To construct the Mega Service, we utilize the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline within the `docsum.py` Python script. Build the MegaService Docker image via below command:
@@ -149,9 +125,6 @@ You will have the following Docker Images:
2. `opea/docsum:latest`
3. `opea/llm-docsum-tgi:latest`
4. `opea/whisper:latest`
5. `opea/dataprep-audio2text:latest`
6. `opea/dataprep-multimedia2text:latest`
7. `opea/dataprep-video2audio:latest`
### Validate Microservices
@@ -188,37 +161,7 @@ You will have the following Docker Images:
{"asr_result":"you"}
```
4. Audio2Text Microservice
```bash
curl http://${host_ip}:9099/v1/audio/transcriptions \
-X POST \
-d '{"byte_str":"UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"}' \
-H 'Content-Type: application/json'
```
Expected output:
```bash
{"downstream_black_list":[],"id":"--> this will be different id number for each run <--","query":"you"}
```
5. Multimedia to text Microservice
```bash
curl http://${host_ip}:7079/v1/multimedia2text \
-X POST \
-d '{"audio":"UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"}' \
-H 'Content-Type: application/json'
```
Expected output:
```bash
{"downstream_black_list":[],"id":"--> this will be different id number for each run <--","query":"you"}
```
6. MegaService
4. MegaService
Text:
@@ -257,7 +200,7 @@ You will have the following Docker Images:
-F "stream=true"
```
> Audio and Video file uploads are not supported in docsum with curl request, please use the Gradio-UI.
> Audio and Video file uploads are not supported in docsum with curl request, please use the Gradio-UI. You can still pass base64 string of the audio or video file as follows:
Audio:
@@ -291,7 +234,7 @@ You will have the following Docker Images:
-F "stream=true"
```
7. MegaService with long context
5. MegaService with long context
If you want to deal with long context, can set following parameters and select suitable summary type.

View File

@@ -50,43 +50,12 @@ services:
https_proxy: ${https_proxy}
restart: unless-stopped
dataprep-audio2text:
image: ${REGISTRY:-opea}/dataprep-audio2text:${TAG:-latest}
container_name: dataprep-audio2text-server
ports:
- "9099:9099"
ipc: host
environment:
A2T_ENDPOINT: ${A2T_ENDPOINT}
dataprep-video2audio:
image: ${REGISTRY:-opea}/dataprep-video2audio:${TAG:-latest}
container_name: dataprep-video2audio-server
ports:
- "7078:7078"
ipc: host
environment:
V2A_ENDPOINT: ${V2A_ENDPOINT}
dataprep-multimedia2text:
image: ${REGISTRY:-opea}/dataprep-multimedia2text:${TAG:-latest}
container_name: dataprep-multimedia2text
ports:
- "7079:7079"
ipc: host
environment:
V2A_ENDPOINT: ${V2A_ENDPOINT}
A2T_ENDPOINT: ${A2T_ENDPOINT}
docsum-xeon-backend-server:
image: ${REGISTRY:-opea}/docsum:${TAG:-latest}
container_name: docsum-xeon-backend-server
depends_on:
- tgi-server
- llm-docsum-tgi
- dataprep-multimedia2text
- dataprep-video2audio
- dataprep-audio2text
ports:
- "8888:8888"
environment:
@@ -94,8 +63,8 @@ services:
- https_proxy=${https_proxy}
- http_proxy=${http_proxy}
- MEGA_SERVICE_HOST_IP=${MEGA_SERVICE_HOST_IP}
- DATA_SERVICE_HOST_IP=${DATA_SERVICE_HOST_IP}
- LLM_SERVICE_HOST_IP=${LLM_SERVICE_HOST_IP}
- ASR_SERVICE_HOST_IP=${ASR_SERVICE_HOST_IP}
ipc: host
restart: always