Spaces:
Running
Running
A newer version of the Gradio SDK is available:
5.33.1
Initialize new Hugging Face Space with Gradio SDK 5.x
- Add
mcp-server-track
tag inREADME.md
- Add
Write Python function
symptom_to_diagnosis(symptom_text)
- Use OpenAI or Anthropic API to generate JSON
- Format prompt to request JSON output
- Parse model response into Python dict
- Handle JSON formatting quirks (trim extra text, use
json.loads
) - Implement fallback rule-based mapping for demo cases
Test
symptom_to_diagnosis
function- Input common symptom examples and combinations
- Verify relevance and correctness of ICD codes and diagnoses
- Tweak prompt to improve specificity and JSON validity
Define confidence score methodology
- Decide whether to use model’s self-reported scores or rank order as proxy
- Document how confidence is calculated and interpreted
Integrate function into Gradio Blocks interface
- Use
gr.Interface
orgr.ChatInterface
to accept symptom text input and display JSON output - Configure Gradio app metadata to expose MCP endpoint
- Use
Build demonstration client or script (optional)
- Create minimal client using
gradio.Client
orrequests
to call Space’s prediction API - Alternatively, build a second Gradio Space as a simple chatbot that calls the MCP tool
- Prepare screen recording showing AI agent (e.g., Claude Desktop) calling the MCP endpoint with example query
- Create minimal client using
Update
README.md
documentation- Describe tool functionality and usage examples
- Include
mcp-server-track
tag, link to video or client demo - List technologies used (e.g., “OpenAI GPT-4 API for symptom→ICD mapping”)
Configure OpenAI/Anthropic API usage
- Use cheaper models (e.g., GPT-3.5) during development
- Reserve GPT-4 or Claude-2 for final demo queries to conserve credits
Evaluate Hugging Face / Mistral credits for alternative inference
- Identify open ICD-10 prediction models on HF Inference API (e.g.,
AkshatSurolia/ICD-10-Code-Prediction
) - Consider running open-source models on Mistral if time allows
- Identify open ICD-10 prediction models on HF Inference API (e.g.,
Plan Modal Labs usage for cloud compute (optional)
- Pre-compute ICD-10 embeddings in Modal job if semantic search is added
- Host backend microservice or Gradio app on Modal if HF Space resources are insufficient
Reserve Nebius or Hyperbolic Labs credits for GPU-intensive tasks (if needed)
- Spin up GPU instance to host or fine-tune open-source model only if HF Space times out
Consider LlamaIndex integration for retrieval-augmented generation (bonus)
- Load ICD-10 dataset into LlamaIndex and test semantic search for candidate codes
- Implement minimal index of common diagnoses for demo if time permits
Record and document final demo
- Capture symptom input, MCP tool invocation, and JSON output in a short video
- Host video link in
README.md