|
|
--- |
|
|
license: mit |
|
|
tags: |
|
|
- medical |
|
|
--- |
|
|
# Simple Web UI for MedImageInsight: Open-Source Medical Image Embedding Model |
|
|
|
|
|
This repository is a (somewhat) clone of [Lion AI MedImageInsights](https://huggingface.co/lion-ai/MedImageInsights) and shows how easily you can create a simple Web UI for the Model. |
|
|
I added some less CORS restriction to the fast api server and MPS Support (it was only CUDA before) for the medimageinsightmodel.py. |
|
|
|
|
|
CUDA (Compute Unified Device Architecture) and MPS (Metal Performance Shaders) are two frameworks that enable GPU acceleration, but they are platform-specific: |
|
|
|
|
|
- **CUDA** is a parallel computing platform developed by NVIDIA. It provides tools and libraries specifically designed to utilize NVIDIA GPUs for intensive computations, making it a preferred choice for deep learning and AI on systems with NVIDIA hardware. |
|
|
|
|
|
- **MPS** (Metal Performance Shaders) is Apple’s framework for GPU-accelerated processing on macOS and iOS. It provides GPU support for Metal-compatible devices, including Apple's own hardware (like M1/M2 chips). Using MPS allows machine learning models to run on Apple hardware without needing an NVIDIA GPU. |
|
|
|
|
|
In this Web UI, MPS support has been added to make the tool accessible on Apple devices with Metal-compatible GPUs, not just on NVIDIA GPUs with CUDA. |
|
|
|
|
|
**Long story short:** If you are on a Mac, you might get better performance with MPS. After running the Fast API you see "Using MPS backend for model execution." if its supported by our machine. |
|
|
|
|
|
|
|
|
## Known Issues |
|
|
In the UI, selecting an URL does not always work due to CORS issues. Take local images to be save. |
|
|
|
|
|
## Screenshot |
|
|
|
|
|
|
|
|
 |
|
|
 |
|
|
|
|
|
## General |
|
|
|
|
|
Check out [Lion AI MedImageInsights](https://huggingface.co/lion-ai/MedImageInsights) for further details. |
|
|
|
|
|
|
|
|
## Usage |
|
|
|
|
|
1. Clone the repository and navigate to the project directory. |
|
|
|
|
|
Make sure you have git-lfs installed (https://git-lfs.com) |
|
|
```bash |
|
|
git lfs install |
|
|
``` |
|
|
|
|
|
```bash |
|
|
git clone https://huggingface.co/frappierer/Simple_MedImageInsights_Web_UI |
|
|
``` |
|
|
3. Install the required dependencies |
|
|
We are using [uv](https://github.com/astral-sh/uv) package manager to simplify the installation. |
|
|
Also check out the [UV Docs](https://docs.astral.sh/uv/getting-started/installation/#__tabbed_2_1) on how to setup UV. |
|
|
|
|
|
4. Run Fast API Server (My Simple Web UI will query against that server) |
|
|
|
|
|
FYI:I had to add a CORS middleware to the API Server, so API request from localhost dont get blocked. |
|
|
```bash |
|
|
cd Simple_MedImageInsights_Web_UI |
|
|
``` |
|
|
then run |
|
|
```bash |
|
|
uv run fastapi_app.py |
|
|
``` |
|
|
That will take some time and you will see: |
|
|
|
|
|
 |
|
|
|
|
|
Optionally: Go to localhost:8000/docs to see the swagger API Doc. |
|
|
|
|
|
5. Open the index.html. |
|
|
|
|
|
In the "Images" Folder I added some examples I found online. |
|
|
|
|
|
Have fun. |
|
|
|
|
|
## Extend Labels |
|
|
To Show more labels in the UI just edit the labels in script.js |
|
|
// Define your labels |
|
|
```bash |
|
|
const medicalLabels = [ |
|
|
... |
|
|
|
|
|
Then refresh the index.html |
|
|
``` |