brain-chatbot / README.md
morefaat69's picture
Upload 5 files
dcf8f04 verified
|
Raw
History Blame Contribute Delete
2.5 kB
---
title: NeuroBot - Brain Tumor Assistant
colorFrom: blue
colorTo: indigo
sdk: docker
pinned: false
license: mit
---
# NeuroBot β€” Brain Tumor AI Assistant
NeuroBot is a specialized AI chatbot designed to help patients and their families navigate brain tumor-related questions. It provides empathetic, responsible guidance on symptoms, tumor types, diagnostic methods, and treatment options.
> **Medical Disclaimer**: NeuroBot is NOT a substitute for professional medical advice. Always consult a licensed neurologist or neurosurgeon for diagnosis and treatment.
---
## Features
- Conversational multi-turn chat with memory
- Structured symptom assessment with follow-up questions
- Automatic detection of emergency red-flag symptoms
- Strict scope enforcement β€” only answers brain tumor-related questions
- Powered by LLaMA 3.3 70B via Groq API
---
## API Endpoints
### `POST /chat`
Send a message and get a response.
**Request body:**
```json
{
"message": "I've been having headaches for 2 weeks",
"history": [
{ "role": "user", "content": "Hello" },
{ "role": "assistant", "content": "Hello! How can I help you today?" }
]
}
```
**Response:**
```json
{
"reply": "I'm sorry to hear you've been experiencing headaches..."
}
```
### `GET /`
Health check endpoint.
---
## Setup & Deployment
### Environment Variables
Set the following secret in your Hugging Face Space settings:
| Variable | Description |
|---|---|
| `GROQ_API_KEY` | Your Groq API key from [console.groq.com](https://console.groq.com) |
### Local Development
```bash
# Install dependencies
pip install -r requirements.txt
# Set your API key
export GROQ_API_KEY=your_key_here
# Run the server
uvicorn app:app --host 0.0.0.0 --port 7860 --reload
```
---
## Project Structure
```
β”œβ”€β”€ app.py # FastAPI application
β”œβ”€β”€ system_prompt.txt # AI behavior and instructions
β”œβ”€β”€ requirements.txt # Python dependencies
β”œβ”€β”€ Dockerfile # Container configuration
└── README.md # This file
```
---
## About the Model
This chatbot is part of a larger Brain Tumor Classification project using a CNN model trained to classify MRI scans into tumor categories (Glioma, Meningioma, Pituitary, No Tumor).
---
## Emergency Notice
If you or someone you know is experiencing:
- Sudden severe headache
- Sudden vision loss
- Seizures
- Loss of consciousness
**Please call emergency services immediately (123 in Egypt / 911 in US)**