| title | MedBot |
|---|---|
| emoji | 🤖 |
| colorFrom | blue |
| colorTo | green |
| sdk | gradio |
| sdk_version | 6.15.2 |
| python_version | 3.11 |
| app_file | app.py |
| pinned | false |
A retrieval-augmented generation (RAG) demo project designed for a Hugging Face Spaces-friendly Gradio deployment.
This repository is structured for a Space that uses a Gradio app. To make the Space reproducible, the project includes:
requirements.txtwith a pinned Gradio version.README.mdwith installation, usage, and deployment notes.ui/gradio_dashboard.pyas the intended Gradio app entrypoint.
Recommended environment:
- Python 3.10 or 3.11
gradio==6.15.2numpy<2requestsPyPDF2==3.0.1sentence-transformers==5.5.1faiss-cpu==1.8.0torch>=2.0.0python-dotenvfor loading local.envfiles when present
Install dependencies:
pip install -r requirements.txtIf
faissis not available in your local environment, the pipeline will still work with a fallback search method, but installingfaiss-cpugives better retrieval performance.
If you add your Gradio interface to ui/gradio_dashboard.py, run locally with:
python ui/gradio_dashboard.pyFor a basic Gradio app, this file should create a gr.Interface or gr.Blocks instance and call launch().
A simple root-level script is available for running retrieval directly from a pickle store:
python main.py --query "what is diabetes" --top-k 3By default, the script loads rag_store_cpu.pkl from the repository root. To specify a different store file:
python main.py --path path/to/rag_store_cpu.pkl --query "what is diabetes"To deploy on Hugging Face Spaces:
- Push this repo to a Hugging Face Space.
- Ensure
requirements.txtis present. - Confirm
app.pyor your Gradio entrypoint is referenced in the Space settings if needed. - Use a compatible runtime: CPU is fine for light demos, GPU may be required for larger models.
- Runtime:
cpufor simple demos - Python version:
3.10or3.11 - Install command:
pip install -r requirements.txt
This repo currently has a working app shell at ui/gradio_dashboard.py.
The app is already configured to load these medical PDF links:
https://bookchapter.org/kitaplar/Medical%20Diagnosis%20and%20Treatment%20Methods%20in%20Basic%20Medical%20Sciences.pdfhttps://applications.emro.who.int/dsaf/dsa236.pdfhttps://www.dhhs.nh.gov/sites/g/files/ehbemt476/files/documents/2021-11/disease-handbook-complete.pdfhttps://aiimsrishikesh.edu.in/documents/standard-treatment-guidelines.pdfhttps://www.fao.org/4/y1238e/y1238e06.pdf
To use the demo, configure the Gemini API key on the backend, then run the app locally:
export GEMINI_API_KEY="your_gemini_api_key"
python ui/gradio_dashboard.pySupported backend key names: GEMINI_API_KEY, GOOGLE_API_KEY, and GOOGLE_GENAI_API_KEY.
Then open the Gradio link in your browser, ask a question, and the backend will retrieve PDF passages before sending them to Gemini.
Add a license file and any model attribution required by your dataset or API provider.
If you need a direct model or API integration, add the dependency to requirements.txt and document it here.