--- title: Med emoji: 🏆 colorFrom: blue colorTo: purple sdk: gradio sdk_version: 5.20.1 app_file: app.py pinned: false short_description: Medical field with next‑gen technology --- # AI-Powered Medical Knowledge Graph Assistant This project uses: - **BioGPT-Large-PubMedQA** for specialized biomedical question-answering - **PubMed API** + **Chroma** for retrieval-augmented generation - **Pyvis** to visualize relevant docs and medical terms - **Gradio** + **FastAPI** for an interactive UI and robust routing ## Setup 1. **Install dependencies**: ```bash pip install -r requirements.txt Set your PubMed API key (optional, but recommended for higher rate limits): bash Copy export PUBMED_API_KEY="YOUR_NCBI_API_KEY" Run locally: bash Copy python app.py Then open http://localhost:7860 in your browser. Hugging Face Spaces: Select FastAPI or Gradio + FastAPI as the SDK. Push this repo to your Space. The app object in app.py should be auto-detected. Wait for the build, then test it out! How It Works User enters a query (e.g., "Fever and cough treatment"). Retrieval: The app fetches PubMed abstracts via E-utilities, indexes them in Chroma, then pulls the top 3 relevant docs. BioGPT QA: The retrieved docs are appended as context to the LLM prompt. BioGPT then generates a specialized medical answer. Graph Visualization: The docs and extracted key terms are turned into a Pyvis network, served by a separate /graph endpoint. Display: Gradio shows the textual answer, plus an