Spaces:
Sleeping
Sleeping
Upload 5 files
Browse files- .gitignore +6 -0
- README.md +46 -12
- requirements.txt +6 -0
- template.py +33 -0
- π _Home.py +27 -0
.gitignore
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
experiments/.ipynb_checkpoints*
|
2 |
+
.env
|
3 |
+
src/__pycache__*
|
4 |
+
utils/__*
|
5 |
+
test_images/__*
|
6 |
+
temp_image*
|
README.md
CHANGED
@@ -1,12 +1,46 @@
|
|
1 |
-
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
-
sdk: streamlit
|
7 |
-
sdk_version: 1.41.
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: medical-report-analyzer
|
3 |
+
emoji: π»
|
4 |
+
colorFrom: red
|
5 |
+
colorTo: purple
|
6 |
+
sdk: streamlit
|
7 |
+
sdk_version: 1.41.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
license: mit
|
11 |
+
---
|
12 |
+
## Medical Report Analysis Using LLM
|
13 |
+
|
14 |
+
|
15 |
+
π This project is a **Medical Report Analysis System** that simplifies the explanation of medical reports using AI π§ and provides natural healing suggestions π±.
|
16 |
+
|
17 |
+
### **Problem Statement:**
|
18 |
+
Many people find it challenging to understand medical reports, especially those from non-medical backgrounds. This project aims to make it easier for everyone to comprehend their medical reports and promote better health literacy π.
|
19 |
+
|
20 |
+
|
21 |
+
π‘ **Key Features:**
|
22 |
+
- Focus on problem areas in the report π©Ί
|
23 |
+
- Easy-to-understand explanations π
|
24 |
+
- Natural remedies for healing ππΏ
|
25 |
+
|
26 |
+
π οΈ **Tech Stack:**
|
27 |
+
- **Python** π
|
28 |
+
- **Streamlit** π
|
29 |
+
- **Gemini** π§
|
30 |
+
- **EasyOCR** π
|
31 |
+
- **Pillow** π
|
32 |
+
|
33 |
+
|
34 |
+
π» **Source of Report:**
|
35 |
+
- Sample reports from publicly available Websites π
|
36 |
+
1. *https://drlogy.com/blog/blood-report-format#:~:text=Blood%20Report%20Format%20Examples%20&%20PDF.%2010%20Key%20Blood%20Report*
|
37 |
+
|
38 |
+
2. *https://cdn1.lalpathlabs.com/live/reports/WM17S.pdf#:~:text=Test%20Report%20Test%20Name%20Results%20Units%20Bio.%20Ref.%20Interval%20Note*
|
39 |
+
|
40 |
+
|
41 |
+
β οΈ **Disclaimer**: This project is for **educational purposes only** π and is not a substitute for professional medical advice.
|
42 |
+
|
43 |
+
|
44 |
+
### Video :-
|
45 |
+
|
46 |
+
[Demo](https://github.com/LalitMahale/Medical-Report-Analysis-using-LLM/blob/main/videos/medical_report_analyzer_video.mp4)
|
requirements.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
python-dotenv==1.0.1
|
2 |
+
pymupdf==1.24.11
|
3 |
+
easyocr==1.7.2
|
4 |
+
google-generativeai==0.7.2
|
5 |
+
streamlit==1.38.0
|
6 |
+
pillow==10.4.0
|
template.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from pathlib import Path
|
3 |
+
|
4 |
+
list_file = [
|
5 |
+
"src/__init__.py",
|
6 |
+
"src/pipeline.py",
|
7 |
+
"src/settings.py",
|
8 |
+
"src/prompts.py",
|
9 |
+
"logs/medical_report_analysis.log",
|
10 |
+
"test_docs/.gitkeep",
|
11 |
+
"app.py",
|
12 |
+
"experiments/experiments.ipynb",
|
13 |
+
".env",
|
14 |
+
"Dockerfile",
|
15 |
+
"requirements.txt",
|
16 |
+
".gitignore",
|
17 |
+
"README.md",
|
18 |
+
|
19 |
+
|
20 |
+
]
|
21 |
+
|
22 |
+
|
23 |
+
for file in list_file:
|
24 |
+
file = Path(file)
|
25 |
+
folder, filename = os.path.split(file)
|
26 |
+
|
27 |
+
if not os.path.exists(folder) and folder != "":
|
28 |
+
os.makedirs(folder,exist_ok=True)
|
29 |
+
|
30 |
+
if not os.path.exists(file) or (os.path.getsize(file)==0):
|
31 |
+
with open(file=file,mode="w") as f:
|
32 |
+
pass
|
33 |
+
|
π _Home.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from src.pipeline import Pipeline
|
3 |
+
from dotenv import load_dotenv
|
4 |
+
import os
|
5 |
+
|
6 |
+
check = load_dotenv()
|
7 |
+
|
8 |
+
|
9 |
+
st.set_page_config(page_title="π©Ί Medical Report Analyzer",page_icon= "*")
|
10 |
+
|
11 |
+
st.markdown("<h1 style='text-align: center;'>Medical Report Analyzer π</h1>", unsafe_allow_html=True)
|
12 |
+
st.caption("Health Insights Based on The Lab Reports")
|
13 |
+
|
14 |
+
if not check:
|
15 |
+
api_key = st.text_input("API KEY",placeholder='Provide google api key',help="click to get api key : https://ai.google.dev/")
|
16 |
+
os.environ['GOOGLE_API_KEY'] = api_key
|
17 |
+
|
18 |
+
|
19 |
+
file = st.file_uploader(label="Upload Lab Report", type=["PDF", "JPG", "PNG", "JPEG"])
|
20 |
+
if st.button("Process"):
|
21 |
+
if file != None:
|
22 |
+
file_type = file.name.split(".")[-1]
|
23 |
+
response = Pipeline.process(file=file,type = file_type)
|
24 |
+
st.write(response)
|
25 |
+
|
26 |
+
else:
|
27 |
+
st.warning("Please Upload file.",icon="β οΈ")
|