This project is a web-based application built with Streamlit
for generating information from Patient Information Leaflets (PILs). The application allows users to upload images or PDF files of PILs, from which it extracts text and uses a Generative AI model to identify relevant drug information.
The generated information includes:
- Drug Name
- Intended Use
- Dosage
- Side Effects
- Precautions
- Interactions
- Storage Instructions
- Expiration Date
- Upload PIL as an image (
PNG
,JPG
, orJPEG
) or PDF. - Extract text from the PIL using OCR (
pytesseract
). - For PDFs, extract text using
PyPDF2
. - Use Google Generative AI to extract relevant drug information from the PIL text.
- Display extracted information in an easy-to-read format.
Before you start, ensure you have Python
installed on your system.
To run this project, you will need to install the following Python libraries:
pip install streamlit google-generativeai pytesseract python-dotenv pillow PyPDF2
For text extraction from images, Tesseract OCR must be installed separately. You can install it as follows:
-
Windows: Download and install the Tesseract Windows installer.
-
Linux: Install using the package manager:
sudo apt install tesseract-ocr
-
MacOS: Install using
brew
:brew install tesseract
To access Google Generative AI, you need to configure an API key in a .env
file. Create a .env
file in the project root directory with the following content:
API_KEY=your_google_generative_ai_api_key
Replace your_google_generative_ai_api_key
with the actual API key.
-
Clone this repository:
git clone https://github.com/pfrimpong11/pil-extraction-app.git cd pil-extraction-app
-
Install the required dependencies:
pip install -r requirements.txt
-
Run the Streamlit app:
streamlit run app.py
-
Open the provided link in your browser to interact with the app.
- Upload a PIL image (PNG, JPG, JPEG) or PDF.
- The app will extract the text and generate the relevant drug information.
- Review the extracted data such as drug name, dosage, and side effects.
Enjoy using the PIL Information Extraction Web App!