A newer version of the Gradio SDK is available: 6.22.0
title: Skin Disease Detection Demo
emoji: ๐ฉบ
colorFrom: blue
colorTo: pink
sdk: gradio
sdk_version: 4.44.0
app_file: app.py
pinned: false
license: apache-2.0
๐ฉบ Skin Disease Detection โ Demo
A demo Space where users can:
- Upload a skin image (or click a bundled test image) and get an AI classifier's prediction across common skin-lesion categories, plus a plain-language explanation from an LLM.
- Chat with an assistant about skin-health topics in general terms.
โ ๏ธ This is an educational demo, not a medical device. It does not diagnose anyone. Always see a licensed dermatologist or doctor for real concerns.
How it works
| Component | What it does | Default model |
|---|---|---|
| Image classifier | Predicts a skin-lesion category from a photo | Anwarkh1/Skin_Cancer-Image_Classification (ViT, trained on a HAM10000-derived dataset) |
| Chat / explanation | Turns predictions into plain language, answers general questions | HuggingFaceH4/zephyr-7b-beta via the Hugging Face Inference API |
Both model IDs are configurable via Space variables โ see below.
๐ Deploy in 3 steps
Create a new Space Go to huggingface.co/new-space โ choose Gradio as the SDK โ CPU basic hardware is fine for the classifier.
Upload these files Upload
app.py,requirements.txt, thisREADME.md, and theexamples/folder (if you generated test images โ see below) to the Space repo, either via the web UI ("Add file") or:git clone https://huggingface.co/spaces/<your-username>/<your-space-name> cp -r app.py requirements.txt README.md examples <your-space-name>/ cd <your-space-name> git add . && git commit -m "Initial commit" && git pushAdd an
HF_TOKENsecret (to enable the chatbot) In your Space โ Settings โ Variables and secrets โ New secret:- Name:
HF_TOKEN - Value: a Hugging Face access token (create one at huggingface.co/settings/tokens, "Read" scope is enough)
Without this secret, image classification still works โ only the LLM-generated explanations and the chat tab need the token.
- Name:
That's it โ the Space will build and the app will be live.
๐ผ๏ธ Adding test images (optional but recommended)
So users have something to click without needing their own photo, generate a few sample images once, locally, before you push:
pip install datasets pillow
python scripts/download_examples.py
This saves a handful of JPEGs into examples/. Include that folder when you
push to your Space. You can also just drop in your own sample .jpg/.png
files instead.
โ๏ธ Configuration
Set these as Space variables (not secret, unless noted) to customize:
IMAGE_MODEL_IDโ any Hugging Face image-classification model compatible withtransformers.pipeline("image-classification", ...).CHAT_MODEL_IDโ any chat-completion-capable model available via the HF Inference API.HF_TOKEN(secret) โ required for the chat tab and the LLM explanations.
๐ฉน Limitations & responsible use
- The bundled classifier was trained on a research dataset (HAM10000-derived dermatoscopic images) and has real, published accuracy limits โ treat its output as a talking point, not a result.
- Performance depends heavily on image quality, lighting, and skin tone representation in the training data.
- This app must not be used as a substitute for professional medical evaluation, and the chatbot is instructed to avoid giving diagnoses, treatments, or dosages.
Local development
pip install -r requirements.txt
export HF_TOKEN=your_token_here # optional, for chat
python app.py