Skip to content

Commit 03e44ee

Browse files
authored
Merge branch 'master' into feat/gh-actions
2 parents 0ae5172 + c1e1f2a commit 03e44ee

107 files changed

Lines changed: 6862 additions & 2081 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Dockerfile

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ ARG UV_ARGUMENTS=""
44
# We select the image based on the platform argument
55

66
# Define GPU image
7-
FROM "nvidia/cuda:12.2.2-base-ubuntu22.04" AS gpu
7+
FROM nvidia/cuda:12.2.2-base-ubuntu22.04 AS gpu
88
ARG PLATFORM
99
RUN echo "Using GPU image"
1010

1111
# Define cpu image
12-
FROM ubuntu:22.04 as cpu
12+
FROM ubuntu:22.04 AS cpu
1313
ARG PLATFORM
1414
ARG UV_ARGUMENTS="--extra cpu"
1515
RUN echo "Using CPU-only image"
@@ -20,10 +20,17 @@ ARG PLATFORM
2020

2121
COPY --from=ghcr.io/astral-sh/uv:0.5.8 /uv /uvx /bin/
2222

23-
RUN apt-get update && \
24-
apt-get install -y --no-install-recommends \
25-
nano curl ffmpeg libsm6 libxext6 chromium-browser libnss3 libgconf-2-4 libxi6 libxrandr2 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxrender1 libasound2 libatk1.0-0 libgtk-3-0 libreoffice libjpeg-dev
23+
RUN apt-get update && apt-get install -y python3-pip && pip3 install uv
2624

25+
RUN apt-get update && \
26+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
27+
tzdata nano curl ffmpeg libsm6 libxext6 chromium-browser libnss3 libgconf-2-4 \
28+
libxi6 libxrandr2 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxrender1 \
29+
libasound2 libatk1.0-0 libgtk-3-0 libreoffice libjpeg-dev libpango-1.0-0 \
30+
libpangoft2-1.0-0 weasyprint && \
31+
ln -fs /usr/share/zoneinfo/Europe/Zurich /etc/localtime && \
32+
dpkg-reconfigure --frontend noninteractive tzdata && \
33+
apt-get clean && rm -rf /var/lib/apt/lists/*
2734

2835
# Copy the project into the image
2936
ADD . /app
@@ -32,13 +39,16 @@ ADD . /app
3239
WORKDIR /app
3340

3441
# Define the build argument with a default value of an empty string (optional)
35-
36-
RUN uv sync --frozen ${UV_ARGUMENTS}
42+
COPY pyproject.toml ./
43+
# RUN uv sync --frozen ${UV_ARGUMENTS}
3744

3845

3946
# make uv's python the default python for the image
4047
ENV PATH="/app/.venv/bin:$PATH"
4148

49+
# install mpmath
50+
RUN uv pip install -e . --system
51+
4252
ENV DASK_DISTRIBUTED__WORKER__DAEMON=False
4353

4454
ENTRYPOINT /bin/bash

README.md

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Our package requires system dependencies. This snippet will take care of install
2929
sudo apt update
3030
sudo apt install -y ffmpeg libsm6 libxext6 chromium-browser libnss3 \
3131
libgconf-2-4 libxi6 libxrandr2 libxcomposite1 libxcursor1 libxdamage1 \
32-
libxext6 libxfixes3 libxrender1 libasound2 libatk1.0-0 libgtk-3-0 libreoffice
32+
libxext6 libxfixes3 libxrender1 libasound2 libatk1.0-0 libgtk-3-0 libreoffice \
33+
libpango-1.0-0 libpangoft2-1.0-0 weasyprint
3334
```
3435

3536
#### Step 1 – Install MMORE
@@ -40,12 +41,6 @@ To install the package simply run:
4041
pip install -e .
4142
```
4243

43-
To install additional RAG-related dependencies, run:
44-
45-
```bash
46-
pip install -e '.[rag]'
47-
```
48-
4944
> :warning: This is a big package with a lot of dependencies, so we recommend to use `uv` to handle `pip` installations. [Check our tutorial on uv](./docs/uv.md).
5045
5146
### Minimal Example
@@ -54,13 +49,14 @@ You can use our predefined CLI commands to execute parts of the pipeline. Note t
5449

5550
```bash
5651
# Run processing
57-
mmore process --config-file examples/process/config.yaml
52+
python -m mmore process --config-file examples/process/config.yaml
53+
python -m mmore postprocess --config-file examples/postprocessor/config.yaml --input-data examples/process/outputs/merged/merged_results.jsonl
5854

5955
# Run indexer
60-
mmore index --config-file examples/index/config.yaml
56+
python -m mmore index --config-file examples/index/config.yaml --documents-path examples/process/outputs/merged/final_pp.jsonl
6157

6258
# Run RAG
63-
mmore rag --config-file examples/rag/api/rag_api.yaml
59+
python -m mmore rag --config-file examples/rag/config.yaml
6460
```
6561

6662
You can also use our package in python code as shown here:
@@ -70,35 +66,34 @@ from mmore.process.processors.pdf_processor import PDFProcessor
7066
from mmore.process.processors.base import ProcessorConfig
7167
from mmore.type import MultimodalSample
7268

73-
pdf_file_paths = ["examples/sample_data/pdf/calendar.pdf"]
74-
out_file = "results/example.jsonl"
69+
pdf_file_paths = ["/path/to/examples/sample_data/pdf/calendar.pdf"] #write here the full path, not a relative path
70+
out_file = "/path/to/examples/process/outputs/example.jsonl"
7571

76-
pdf_processor_config = ProcessorConfig(custom_config={"output_path": "results"})
72+
pdf_processor_config = ProcessorConfig(custom_config={"output_path": "examples/process/outputs"})
7773
pdf_processor = PDFProcessor(config=pdf_processor_config)
78-
result_pdf = pdf_processor.process_batch(pdf_file_paths, True, 1) # args: file_paths, fast mode (True/False), num_workers
74+
result_pdf = pdf_processor.process_batch(pdf_file_paths, False, 1) # args: file_paths, fast mode (True/False), num_workers
7975

8076
MultimodalSample.to_jsonl(out_file, result_pdf)
8177
```
8278

8379
---
8480

85-
8681
### Usage
8782

88-
To launch the MMORE pipeline follow the specialised instructions in the docs.
83+
To launch the MMORE pipeline, follow the specialised instructions in the docs.
8984

9085
![The MMORE pipelines archicture](https://github.com/user-attachments/assets/0cd61466-1680-43ed-9d55-7bd483a04a09)
9186

9287

9388
1. **:page_facing_up: Input Documents**
94-
Upload your multimodal documents (PDFs, videos, spreadsheets, and more) into the pipeline.
89+
Upload your multimodal documents (PDFs, videos, spreadsheets, and m(m)ore) into the pipeline.
9590

9691
2. [**:mag: Process**](./docs/process.md)
97-
Extracts and standardizes text, metadata, and multimedia content from diverse file formats. Easily extensible! You can add your own processors to handle new file types.
92+
Extracts and standardizes text, metadata, and multimedia content from diverse file formats. Easily extensible! You can add your own processors to handle new file types.
9893
*Supports fast processing for specific types.*
9994

10095
3. [**:file_folder: Index**](./docs/index.md)
101-
Organizes extracted data into a **hybrid retrieval-ready Vector Store DB**, combining dense and sparse indexing through [Milvus](https://milvus.io/). Your vector DB can also be remotely hosted and then you only have to provide a standard API.
96+
Organizes extracted data into a **hybrid retrieval-ready Vector Store DB**, combining dense and sparse indexing through [Milvus](https://milvus.io/). Your vector DB can also be remotely hosted and then you only have to provide a standard API. There is also an [HTTP Index API](./docs/index_api.md) for adding new files on the fly with HTTP requests.
10297

10398
4. [**:robot: RAG**](./docs/rag.md)
10499
Use the indexed documents inside a **Retrieval-Augmented Generation (RAG) system** that provides a [LangChain](https://www.langchain.com/) interface. Plug in any LLM with a compatible interface or add new ones through an easy-to-use interface.
@@ -108,7 +103,7 @@ To launch the MMORE pipeline follow the specialised instructions in the docs.
108103
*Coming soon*
109104
An easy way to evaluate the performance of your RAG system using Ragas.
110105

111-
See [the `/docs` directory](/docs) for additional details on each modules and hands-on tutorials on parts of the pipeline.
106+
See [the `/docs` directory](./docs) for additional details on each modules and hands-on tutorials on parts of the pipeline.
112107

113108

114109
#### :construction: Supported File Types
@@ -118,7 +113,7 @@ See [the `/docs` directory](/docs) for additional details on each modules and ha
118113
| **Text Documents** | DOCX, MD, PPTX, XLSX, TXT, EML | CPU | :x:
119114
| **PDFs** | PDF | GPU/CPU | :white_check_mark:
120115
| **Media Files** | MP4, MOV, AVI, MKV, MP3, WAV, AAC | GPU/CPU | :white_check_mark:
121-
| **Web Content (TBD)** | Webpages | GPU/CPU | :white_check_mark:
116+
| **Web Content** | HTML | CPU | :white_check_mark:
122117

123118

124119
## Contributing
@@ -134,7 +129,3 @@ Don't hesitate to star the project :star: if you find it interesting! (you would
134129
## License
135130

136131
This project is licensed under the Apache 2.0 License, see the [LICENSE :mortar_board:](LICENSE) file for details.
137-
138-
## Acknowledgements
139-
140-
This project is part of the [**OpenMeditron**](https://huggingface.co/OpenMeditron) initiative developed in [LiGHT](https://www.light-laboratory.org/) lab at EPFL/Yale/CMU Africa in collaboration with the [**SwissAI**](https://www.swiss-ai.org/) initiative. Thank you Scott Mahoney, Mary-Anne Hartley
Lines changed: 26 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
Before setting up the dashboard, it is useful to understand how it works. You can think of the dashboard as being made up of 4 separate parts:
1515

1616
<p align="center">
17-
<img src="doc_images/image.png" width="1000">
17+
<img src="doc_images/backend_image.png" width="1000">
1818
</p>
1919

2020
| | |
2121
|------------|---|
22-
| **Frontend:** the actual dashboard user interface (UI), and what will be displayed on your screen. | ![Frontend](doc_images/image%201.png) |
23-
| **Database:** the database which stores information about the file processing. | ![Database](doc_images/image%202.png) |
24-
| **Processing Pipeline:** the pipeline processing your documents for which you want to be able to visualize on the dashboard. | ![Pipeline](doc_images/image%203.png) |
25-
| **Backend Server:** *backend* is what we call the server that acts like the middle man to the 3 elements above. It receives information from the processing pipeline, stores and retrieves data from the database and sends information to be displayed on the frontend dashboard. | ![Backend](doc_images/image%204.png) |
22+
| **Frontend:** the actual dashboard user interface (UI), and what will be displayed on your screen. | ![Frontend](doc_images/backend_image%201.png) |
23+
| **Database:** the database which stores information about the file processing. | ![Database](doc_images/backend_image%202.png) |
24+
| **Processing Pipeline:** the pipeline processing your documents for which you want to be able to visualize on the dashboard. | ![Pipeline](doc_images/backend_image%203.png) |
25+
| **Backend Server:** *backend* is what we call the server that acts like the middle man to the 3 elements above. It receives information from the processing pipeline, stores and retrieves data from the database and sends information to be displayed on the frontend dashboard. | ![Backend](doc_images/backend_image%204.png) |
2626

2727

2828
## 2. Setup
@@ -35,15 +35,15 @@ Each element shown above is created in a different terminal. This means that you
3535
Official documentation for MongoDB setup can be found [here](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/) (Ubuntu 22.04 Jammy release).
3636

3737
<p align="center">
38-
<img src="doc_images/image%205.png" width="500">
38+
<img src="doc_images/backend_image%205.png" width="500">
3939
</p>
4040

4141
### Manual Setup Instructions
4242

4343
1. **Install required tools**
4444

4545
```bash
46-
sudo apt-get install gnupg curl
46+
sudo apt install gnupg curl
4747
```
4848

4949
- `gnupg`: Encryption tool for secure communication and data storage
@@ -74,25 +74,25 @@ This adds the official MongoDB repository to your package sources, specificall
7474
4. **Install MongoDB**
7575

7676
```bash
77-
sudo apt-get update
78-
sudo apt-get install -y mongodb-org
79-
sudo apt-get install -y mongodb-org=8.0.5 mongodb-org-database=8.0.5 mongodb-org-server=8.0.5 mongodb-mongosh mongodb-org-mongos=8.0.5 mongodb-org-tools=8.0.5
77+
sudo apt update
78+
sudo apt install -y mongodb-org=8.0.5
79+
sudo apt install -y mongodb-org-database mondogb-org-server mongodb-mongosh mongodb-org-mongos mongodb-org-tools
8080
```
8181

8282
> ✏️ **Note**: You will be prompted to select your timezone during installation. For instance for Switzerland, enter '8' for Europe and then '63' for the timezone.
8383
8484
5. **Create Data Directory**
8585

8686
```bash
87-
mkdir -p ~/mongodb
87+
mkdir -p ~/mongodb
8888
```
8989

9090
Creates a directory in root folder to store MongoDB data files.
9191

9292
6. **Start the MongoDB Server**
9393

9494
```bash
95-
mongod --bind_ip_all --dbpath ~/mongodb
95+
mongod --bind_ip_all --dbpath ~/mongodb
9696
```
9797

9898
This starts MongoDB with the following configuration:
@@ -154,7 +154,7 @@ This script automatically checks if MongoDB is installed, installs it if needed
154154
This backend serves as the bridge between the **database,** the **frontend** and **processing pipeline**, providing a clean API to interact with the data without direct database access.
155155

156156
<p align="center">
157-
<img src="doc_images/image%206.png" width="800">
157+
<img src="doc_images/backend_image%206.png" width="800">
158158
</p>
159159

160160
### Setup Instructions
@@ -166,13 +166,7 @@ This backend serves as the bridge between the **database,** the **frontend** and
166166
source .venv/bin/activate
167167
```
168168

169-
2. **Install Dependencies**
170-
171-
```bash
172-
pip install -r src/mmore/dashboard/backend/backend_requirements.txt
173-
```
174-
175-
3. **Configure MongoDB Connection**
169+
2. **Configure MongoDB Connection**
176170

177171
```bash
178172
export MONGODB_URL="mongodb://localhost:27017"
@@ -182,12 +176,12 @@ Sets the environment variable to tell the backend how to connect to MongoDB inst
182176

183177
> 🚨 **Important**: Your MongoDB server should be active before starting the backend.
184178
185-
4. **Start the Backend Server**
179+
3. **Start the Backend Server**
186180

187181
Run the backend on port 8000
188182

189183
```bash
190-
python -m uvicorn src.mmore.dashboard.backend.main:app --host 0.0.0.0 --port 8000
184+
python3 -m mmore dashboard-backend --host 0.0.0.0 --port 8000
191185
```
192186

193187
This command:
@@ -199,7 +193,7 @@ This command:
199193

200194
> 🚨 **Important**: Keep this terminal window open. The backend runs in the foreground and closing the terminal will shut down the server.
201195
202-
5. **Verify the Backend is Running**
196+
4. **Verify the Backend is Running**
203197

204198
You can check if the backend is running correctly by accessing [http://localhost:8000](http://localhost:8000). You should see a response like: `{"message": "Hello World"}`
205199

@@ -215,53 +209,41 @@ The next step is to set up the frontend that will communicate with this backend
215209
This frontend serves as the user-facing component of the system, providing an interface for monitoring and controlling the processing pipeline without requiring direct interaction with the database or backend code.
216210

217211
<p align="center">
218-
<img src="doc_images/image%207.png" width="1000">
212+
<img src="doc_images/backend_image%207.png" width="1000">
219213
</p>
220214

221215
1. **Load Node Version Manager**
222216

223-
```bash
224-
source /usr/local/nvm/nvm.sh
225-
```
226-
227-
This loads Node Version Manager (NVM) into your current shell session. NVM is necessary because the frontend requires a specific version of Node.js that differs from the default version installed on the system.
217+
If it is not already installed, install NVM following the [instructions](https://github.com/nvm-sh/nvm?tab=readme-ov-file#installing-and-updating). Then make sure the Node Version Manager (NVM) is loaded into your current shell session. NVM is necessary because the frontend requires a specific version of Node.js that may differ from the default version installed on the system.
228218

229219
2. **Install and Activate Node.js Version 23**
230220

231221
```bash
232-
sudo -i # give root privileges
233-
nvm install 23
234-
exit # exit root
235-
nvm use 23
222+
nvm install 23
223+
nvm use 23
236224
```
237225

238-
This sequence:
239-
240-
- Starts a shell with root privileges (necessary for the installation)
241-
- Uses NVM to install Node.js version 23
242-
- Exits the root shell
243-
- Sets version 23 as the active Node.js version for your current session
244226
3. **Install Dependencies**
245227

246228
```bash
247229
cd src/mmore/dashboard/frontend # navigte to frontend directory
248-
npm install
230+
npm install
249231
```
250232

251233
This command uses NPM (Node Package Manager) to install all JavaScript dependencies defined in the package.json file. These are libraries and frameworks needed by the frontend.
252234

253235
4. **Configure Backend URL**
254236

255237
```bash
256-
export VITE_BACKEND_API_URL="http://localhost:8000"
238+
export VITE_BACKEND_API_URL="http://0.0.0.0:8000"
257239
```
258240

259241
Sets an environment variable that tells the frontend where to find the backend API. Vite (the build tool) will use this variable during development.
260242

261243
5. **Start Frontend Server**
262244

263245
```bash
264-
npm run dev
246+
npm run dev
265247
```
266248

267249
Executes the development script defined in package.json, and starts a local development server for the frontend application. The terminal will show the URL where the frontend is available (typically [http://localhost:5173](http://localhost:5173/)).
@@ -272,7 +254,7 @@ Executes the development script defined in package.json, and starts a local dev
272254
To complete the dashboard setup, you need to run a process module that will generate data for visualization in the UI.
273255

274256
<p align="center">
275-
<img src="doc_images/image%208.png" width="1000">
257+
<img src="doc_images/backend_image%208.png" width="1000">
276258
</p>
277259

278260
1. **Modify Configuration File**
@@ -289,7 +271,7 @@ source .venv/bin/activate
289271
3. **Run the Process Module**
290272

291273
```bash
292-
python -m src.mmore.processing.run_processor --config examples/process/config.yaml
274+
python3 -m mmore process --config-file examples/process/config.yaml
293275
```
294276

295277
4. **Monitor the Dashboard**

0 commit comments

Comments
 (0)