metadata
title: Med Gemma
emoji: π₯
colorFrom: red
colorTo: red
sdk: docker
app_port: 8501
tags:
- streamlit
- medical
- chatbot
pinned: false
short_description: Med-Gemma Medical Assistant Chat Interface
π₯ Med-Gemma Medical Assistant
A Streamlit chat interface for interacting with the Med-Gemma medical language model deployed on HuggingFace Inference Endpoints.
π Deployment to HuggingFace Spaces
Step 1: Configure Secrets
- Go to your Space settings on HuggingFace
- Navigate to Settings β Variables and secrets
- Add these two secrets:
- Name:
HF_TOKEN| Value: Your HuggingFace API token - Name:
INFERENCE_ENDPOINT| Value: Your inference endpoint URL (e.g.,https://xxx.endpoints.huggingface.cloud)
- Name:
Step 2: Get Your Credentials
HuggingFace API Token:
- Go to HuggingFace Settings - Tokens
- Click "New token", give it a name, select "read" permissions
- Copy the token
Inference Endpoint URL:
- Go to HuggingFace Inference Endpoints
- Find your Med-Gemma endpoint (must be "Running")
- Copy the endpoint URL
Step 3: Deploy
- Push your code to the HuggingFace Space repository
- The Space will automatically build and deploy
- Once ready, users can start chatting immediately - no configuration needed!
π οΈ Local Development
Setup
Create virtual environment:
python -m venv venv venv\Scripts\activateInstall dependencies:
pip install -r requirements.txtConfigure credentials: Create a
.envfile in the project root:HF_TOKEN=your_token_here INFERENCE_ENDPOINT=your_endpoint_url_hereRun the app:
streamlit run src/streamlit_app.pyThe app will open at
http://localhost:8501
π Features
- π¬ Real-time chat interface with Med-Gemma
- βοΈ Adjustable model parameters (temperature, top_p, max tokens)
- π Chat history (persists during session)
- ποΈ Clear chat history button
- π Secure credential management via environment variables
- β OpenAI-compatible API format for vLLM endpoints
- π¨ Clean, professional UI
- π Docker-ready for HuggingFace Spaces
βοΈ Model Parameters
- Max Tokens: Maximum length of the generated response (50-2048)
- Temperature: Controls randomness (0.0 = deterministic, 2.0 = very random)
- Top P: Controls diversity via nucleus sampling (0.0-1.0)
π Security
- β
.envfile is in.gitignore- never committed - β Use HuggingFace Spaces secrets for production
- β
Local
.envfile for development only - β οΈ Never share your HuggingFace API tokens