title: MedQA
emoji: π
colorFrom: red
colorTo: yellow
sdk: streamlit
sdk_version: 1.45.1
app_file: app.py
pinned: false
license: mit
Quantum Healthcare Navigator βοΈπ§ π¬
Welcome to the Quantum Healthcare Navigator, an AI-powered application designed for healthcare professionals. This Hugging Face Space demonstrates the integration of Large Language Models (LLMs), specialized medical information tools, and (simulated) quantum-inspired optimization for treatment suggestions.
β¨ Features
- AI Consultation: Interactive chat with an AI assistant.
- Medical Knowledge Access: Tools for UMLS and BioPortal lookups.
- Quantum Treatment Optimizer: (Simulated) Get suggestions for treatment plans based on patient data.
- User Authentication: Secure login and signup.
- Session Management: Chat history is saved per user session.
- PDF Reports: Download consultation transcripts.
- Dockerized: Easy to deploy and run locally.
π Project Structure
Use code with caution. Markdown quantum_healthcare_app/ βββ app.py # Streamlit entrypoint βββ agent.py # LangChain agent setup βββ pages/ # Streamlit multipage views β βββ 1_Home.py β βββ 2_Consult.py β βββ 3_Reports.py βββ tools/ # LangChain Tool wrappers β βββ init.py β βββ gemini_tool.py β βββ umls_tool.py β βββ bioportal_tool.py β βββ quantum_tool.py βββ models/ # SQLModel definitions & DB init β βββ init.py β βββ db.py β βββ user.py β βββ chat.py βββ services/ # Shared services (auth, logging, PDF) β βββ init.py β βββ auth.py β βββ logger.py β βββ metrics.py β βββ pdf_report.py βββ clinical_nlp/ # ClinicalβNLP helpers β βββ init.py β βββ umls_bioportal.py βββ quantum/ # Quantum optimizer stub β βββ init.py β βββ optimizer.py βββ config/ # Configuration β βββ settings.py βββ assets/ # Images, logos β βββ init.py β βββ logo.png βββ Dockerfile βββ docker-compose.yml # For local development βββ requirements.txt βββ README.md
βοΈ Setup & Configuration
- Clone the repository (if applicable) or create the files as listed.
- Create a
.env
file in the rootquantum_healthcare_app/
directory based on.env.example
. Populate it with your API keys and desired settings.APP_TITLE="Quantum Healthcare Navigator" SECRET_KEY="your_very_secret_key" DATABASE_URL="sqlite:///./quantum_healthcare.db" # Default for HF Spaces OPENAI_API_KEY="sk-..." GEMINI_API_KEY="..." UMLS_API_KEY="..." BIOPORTAL_API_KEY="..." LOG_LEVEL="INFO"
- Hugging Face Space Deployment:
- Create a new Space on Hugging Face.
- Choose "Docker" as the Space SDK (or Streamlit and provide
requirements.txt
). Docker is recommended for this complexity. - Upload your files.
- Go to "Settings" in your Space and add your
.env
variables as Secrets. - The Space should build and run the
Dockerfile
.
π Running Locally (using Docker)
- Ensure Docker and Docker Compose are installed.
- Create and populate your
.env
file as described above. - Build and run the application:
docker-compose up --build
- Open your browser and navigate to
http://localhost:8501
.
π Notes
- The Quantum Optimizer is currently a stub. It simulates quantum processing but doesn't connect to actual quantum hardware.
- UMLS and BioPortal API interactions are simplified. Real integration requires more robust error handling, authentication (e.g., UMLS Ticket Granting Tickets), and result parsing.
- Error handling and logging are basic. Production systems would require more comprehensive strategies.
- Security: While basic authentication is implemented, ensure all security best practices if deploying for wider use (e.g., HTTPS, input validation, dependency scanning).
- This application is for demonstration purposes only and should not be used for actual medical decision-making.
"Built by the World's Greatest AI Engineer" π