Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -6,7 +6,7 @@ emoji: 🚀
|
|
| 6 |
colorFrom: gray
|
| 7 |
colorTo: gray
|
| 8 |
pinned: false
|
| 9 |
-
short_description: '
|
| 10 |
sdk_version: 5.34.2
|
| 11 |
---
|
| 12 |
|
|
@@ -22,6 +22,7 @@ Welcome to **TherapyBot++**, an all-in-one mental wellness assistant — thought
|
|
| 22 |
- 💬 Converse like a caring therapist
|
| 23 |
- 🧬 Suggest likely health conditions from symptoms
|
| 24 |
- 📘 Instantly answer health-related FAQs
|
|
|
|
| 25 |
|
| 26 |
> ⚠️ **Disclaimer:** This app is developed for **educational and informational purposes only**. It is **not a substitute for professional medical advice, diagnosis, or treatment.**
|
| 27 |
|
|
@@ -77,6 +78,20 @@ Ask generic health questions like:
|
|
| 77 |
|
| 78 |
Retrieves the most semantically similar pre-answered question from the dataset using embedding search.
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
---
|
| 81 |
|
| 82 |
## 🧬 How It Works
|
|
@@ -87,6 +102,8 @@ Retrieves the most semantically similar pre-answered question from the dataset u
|
|
| 87 |
Used for:
|
| 88 |
- FAQ matching
|
| 89 |
- Symptom similarity checking
|
|
|
|
|
|
|
| 90 |
|
| 91 |
### 🔍 Retrieval Logic
|
| 92 |
- Uses **cosine similarity** to match user input with embeddings from `.pkl` files.
|
|
@@ -96,7 +113,7 @@ Retrieves the most semantically similar pre-answered question from the dataset u
|
|
| 96 |
|
| 97 |
## 📁 Files Included
|
| 98 |
|
| 99 |
-
- `app.py` – Main Gradio application script combining all
|
| 100 |
|
| 101 |
- `faq_embeddings.pkl` –
|
| 102 |
A serialized dictionary containing:
|
|
@@ -113,26 +130,72 @@ Retrieves the most semantically similar pre-answered question from the dataset u
|
|
| 113 |
- `embeddings`: Vector representations of each symptom
|
| 114 |
🧬 Used to match user-described symptoms to known conditions in the **Symptom Checker** tab.
|
| 115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
- `requirements.txt` –
|
| 117 |
-
|
| 118 |
```text
|
|
|
|
| 119 |
transformers>=4.36.0
|
| 120 |
torch>=2.0.0
|
| 121 |
-
gradio>=4.15.0
|
| 122 |
sentencepiece>=0.1.99
|
| 123 |
sentence-transformers>=2.2.2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
---
|
| 126 |
|
| 127 |
## 🛠️ Tech Stack
|
| 128 |
|
| 129 |
-
- Python 3.10
|
| 130 |
-
- 🤗 Hugging Face Transformers
|
| 131 |
-
- 🔍 Sentence Transformers (MiniLM)
|
| 132 |
-
- 🧠 FLAN-T5 Model
|
| 133 |
-
-
|
| 134 |
-
-
|
| 135 |
-
|
|
|
|
|
|
|
|
|
|
| 136 |
---
|
| 137 |
|
| 138 |
## 📌 Usage Instructions
|
|
@@ -143,4 +206,4 @@ Clone and run locally:
|
|
| 143 |
git clone https://huggingface.co/spaces/raviix46/therapy-chatbot
|
| 144 |
cd therapy-chatbot
|
| 145 |
pip install -r requirements.txt
|
| 146 |
-
python app.py
|
|
|
|
| 6 |
colorFrom: gray
|
| 7 |
colorTo: gray
|
| 8 |
pinned: false
|
| 9 |
+
short_description: 'AI wellness bot for Chat, Symptoms, FAQs & Report Summary'
|
| 10 |
sdk_version: 5.34.2
|
| 11 |
---
|
| 12 |
|
|
|
|
| 22 |
- 💬 Converse like a caring therapist
|
| 23 |
- 🧬 Suggest likely health conditions from symptoms
|
| 24 |
- 📘 Instantly answer health-related FAQs
|
| 25 |
+
- 🧾 Upload and summarize lab/medical reports using AI
|
| 26 |
|
| 27 |
> ⚠️ **Disclaimer:** This app is developed for **educational and informational purposes only**. It is **not a substitute for professional medical advice, diagnosis, or treatment.**
|
| 28 |
|
|
|
|
| 78 |
|
| 79 |
Retrieves the most semantically similar pre-answered question from the dataset using embedding search.
|
| 80 |
|
| 81 |
+
### 🧾 OCR + Summary (Tab 4)
|
| 82 |
+
Upload lab reports (like blood tests) and get AI-generated health summaries.
|
| 83 |
+
|
| 84 |
+
- 🧠 Uses **Google Cloud Vision API** to extract text from scanned reports
|
| 85 |
+
- 🧬 Powered by **Gemini 1.5 Pro** via Google PaLM for medical summarization
|
| 86 |
+
- 📄 Outputs:
|
| 87 |
+
- 🔹 Plain-language report summary
|
| 88 |
+
- 🔍 Highlighted abnormal values with explanations
|
| 89 |
+
- ✅ Health recommendations
|
| 90 |
+
- 🪄 Clean accordion UI to hide/show raw OCR text
|
| 91 |
+
- 📥 Supports JPG/PNG reports with upload preview
|
| 92 |
+
|
| 93 |
+
> Ideal for quick interpretation of CBCs, lipid profiles, and other basic diagnostic reports.
|
| 94 |
+
|
| 95 |
---
|
| 96 |
|
| 97 |
## 🧬 How It Works
|
|
|
|
| 102 |
Used for:
|
| 103 |
- FAQ matching
|
| 104 |
- Symptom similarity checking
|
| 105 |
+
- **OCR Model:** Google Cloud Vision OCR (image-to-text for medical reports)
|
| 106 |
+
- **Summarizer:** Gemini-1.5 Pro API (Google PaLM) for health-focused summary generation
|
| 107 |
|
| 108 |
### 🔍 Retrieval Logic
|
| 109 |
- Uses **cosine similarity** to match user input with embeddings from `.pkl` files.
|
|
|
|
| 113 |
|
| 114 |
## 📁 Files Included
|
| 115 |
|
| 116 |
+
- `app.py` – Main Gradio application script combining all four tools.
|
| 117 |
|
| 118 |
- `faq_embeddings.pkl` –
|
| 119 |
A serialized dictionary containing:
|
|
|
|
| 130 |
- `embeddings`: Vector representations of each symptom
|
| 131 |
🧬 Used to match user-described symptoms to known conditions in the **Symptom Checker** tab.
|
| 132 |
|
| 133 |
+
- `components/llm_ocr_gcv.py` –
|
| 134 |
+
Google Cloud Vision API integration to extract text from uploaded lab report images (JPG/PNG).
|
| 135 |
+
🧾 Used in the **OCR + Summary** tab for high-accuracy OCR.
|
| 136 |
+
|
| 137 |
+
- `components/palm_summarizer.py` –
|
| 138 |
+
Uses Gemini 1.5 Pro via Google PaLM API to generate simplified, patient-friendly medical summaries from the extracted OCR text.
|
| 139 |
+
📋 Structures output into sections like *Findings*, *Abnormal Values*, and *Recommendations*.
|
| 140 |
+
|
| 141 |
+
- `tabs/image_ocr_llm.py` –
|
| 142 |
+
Implements the **OCR + Summary** tab UI with:
|
| 143 |
+
- Image uploader (accordion view)
|
| 144 |
+
- Status indicator (`Processing...`)
|
| 145 |
+
- Structured markdown summary
|
| 146 |
+
- Collapsible raw OCR viewer
|
| 147 |
+
|
| 148 |
+
- `style.css` *(optional)* –
|
| 149 |
+
Custom UI enhancements for Gradio interface:
|
| 150 |
+
- Stylized summary boxes
|
| 151 |
+
- Themed buttons
|
| 152 |
+
- Font/color consistency
|
| 153 |
+
|
| 154 |
- `requirements.txt` –
|
| 155 |
+
Complete dependency list:
|
| 156 |
```text
|
| 157 |
+
# Core ML & Transformers
|
| 158 |
transformers>=4.36.0
|
| 159 |
torch>=2.0.0
|
|
|
|
| 160 |
sentencepiece>=0.1.99
|
| 161 |
sentence-transformers>=2.2.2
|
| 162 |
+
scikit-learn>=1.1.3
|
| 163 |
+
numpy>=1.21.0
|
| 164 |
+
|
| 165 |
+
# UI
|
| 166 |
+
gradio>=4.15.0
|
| 167 |
+
requests>=2.31.0
|
| 168 |
+
gradio_client>=0.8.1
|
| 169 |
+
|
| 170 |
+
# OCR & Image Processing
|
| 171 |
+
pytesseract>=0.3.10
|
| 172 |
+
Pillow>=10.0.0
|
| 173 |
+
pymupdf>=1.23.7
|
| 174 |
+
pdf2image>=1.16.3
|
| 175 |
+
sacremoses>=0.0.53
|
| 176 |
+
|
| 177 |
+
# Translation & Tokenization
|
| 178 |
+
accelerate>=0.27.0
|
| 179 |
+
safetensors>=0.3.3
|
| 180 |
+
|
| 181 |
+
# Google Cloud Vision Support
|
| 182 |
+
google-cloud-vision>=3.4.5
|
| 183 |
+
google-generativeai>=0.3.2
|
| 184 |
|
| 185 |
---
|
| 186 |
|
| 187 |
## 🛠️ Tech Stack
|
| 188 |
|
| 189 |
+
- 🐍 **Python 3.10** – Core programming language
|
| 190 |
+
- 🤗 **Hugging Face Transformers** – For FLAN-T5 text generation and model integration
|
| 191 |
+
- 🔍 **Sentence Transformers (MiniLM)** – For semantic similarity in FAQ and symptom matching
|
| 192 |
+
- 🧠 **FLAN-T5 Fine-tuned Model** – For therapist-style conversational responses
|
| 193 |
+
- 📄 **Google Cloud Vision API** – High-accuracy OCR for scanned lab reports and prescriptions
|
| 194 |
+
- ✍️ **Gemini 1.5 Pro (via Google PaLM)** – Summarizes extracted report text into readable health advice
|
| 195 |
+
- 🖼 **Pytesseract, PDF2Image, Pillow** – Local fallback OCR and image preprocessing support
|
| 196 |
+
- 🎨 **Gradio** – Interactive multi-tab front-end with collapsible sections and Markdown rendering
|
| 197 |
+
- 📦 **Hugging Face Spaces** – Free and deployable hosting environment for the full web app
|
| 198 |
+
|
| 199 |
---
|
| 200 |
|
| 201 |
## 📌 Usage Instructions
|
|
|
|
| 206 |
git clone https://huggingface.co/spaces/raviix46/therapy-chatbot
|
| 207 |
cd therapy-chatbot
|
| 208 |
pip install -r requirements.txt
|
| 209 |
+
python app.py
|