Text Generation
Transformers
Safetensors
qwen3_5
image-text-to-text
medical
healthcare
qwen
conversational
Instructions to use danosethrus/EthioDoc with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use danosethrus/EthioDoc with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="danosethrus/EthioDoc") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("danosethrus/EthioDoc") model = AutoModelForMultimodalLM.from_pretrained("danosethrus/EthioDoc", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use danosethrus/EthioDoc with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "danosethrus/EthioDoc" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "danosethrus/EthioDoc", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/danosethrus/EthioDoc
- SGLang
How to use danosethrus/EthioDoc with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "danosethrus/EthioDoc" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "danosethrus/EthioDoc", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "danosethrus/EthioDoc" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "danosethrus/EthioDoc", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use danosethrus/EthioDoc with Docker Model Runner:
docker model run hf.co/danosethrus/EthioDoc
index.html
Browse files- index.html +74 -0
index.html
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<title>EthioDocs Medical AI</title>
|
| 5 |
+
<style>
|
| 6 |
+
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; max-width: 800px; margin: 40px auto; padding: 20px; background-color: #f0f2f5; }
|
| 7 |
+
.container { background: white; padding: 30px; border-radius: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
|
| 8 |
+
h1 { color: #2c3e50; border-bottom: 2px solid #3498db; padding-bottom: 10px; }
|
| 9 |
+
#input { width: 100%; height: 120px; padding: 15px; border: 2px solid #ddd; border-radius: 10px; font-size: 16px; margin: 15px 0; box-sizing: border-box; }
|
| 10 |
+
#status { color: #7f8c8d; font-style: italic; margin-bottom: 10px; }
|
| 11 |
+
button { background: #3498db; color: white; border: none; padding: 12px 25px; cursor: pointer; border-radius: 8px; font-weight: bold; transition: 0.3s; }
|
| 12 |
+
button:hover { background: #2980b9; }
|
| 13 |
+
button:disabled { background: #bdc3c7; cursor: not-allowed; }
|
| 14 |
+
#result { background: #ecf0f1; padding: 20px; border-radius: 10px; margin-top: 20px; white-space: pre-wrap; color: #2c3e50; border-left: 6px solid #3498db; }
|
| 15 |
+
</style>
|
| 16 |
+
</head>
|
| 17 |
+
<body>
|
| 18 |
+
<div class="container">
|
| 19 |
+
<h1>🏥 EthioDocs Medical Assistant</h1>
|
| 20 |
+
<p>A Grade 10 AI Project by Daniel (WebGPU Powered)</p>
|
| 21 |
+
|
| 22 |
+
<div id="status">Status: Waiting to initialize...</div>
|
| 23 |
+
<button id="init-btn">Start Medical Engine</button>
|
| 24 |
+
|
| 25 |
+
<hr>
|
| 26 |
+
|
| 27 |
+
<textarea id="input" placeholder="Example: I have a persistent cough and a fever of 38°C. What should I do?"></textarea>
|
| 28 |
+
<button id="send-btn" disabled>Get Medical Advice</button>
|
| 29 |
+
|
| 30 |
+
<div id="result">The diagnosis will appear here after initialization.</div>
|
| 31 |
+
</div>
|
| 32 |
+
|
| 33 |
+
<script type="module">
|
| 34 |
+
import { pipeline } from 'https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.0.0';
|
| 35 |
+
|
| 36 |
+
let generator;
|
| 37 |
+
const status = document.getElementById('status');
|
| 38 |
+
const initBtn = document.getElementById('init-btn');
|
| 39 |
+
const sendBtn = document.getElementById('send-btn');
|
| 40 |
+
|
| 41 |
+
initBtn.onclick = async () => {
|
| 42 |
+
initBtn.disabled = true;
|
| 43 |
+
status.innerText = "Status: Downloading Model (4.5GB)... This may take 2-5 minutes.";
|
| 44 |
+
|
| 45 |
+
try {
|
| 46 |
+
// CALLING YOUR SPECIFIC MODEL
|
| 47 |
+
generator = await pipeline('text-generation', 'danosethrus/Medical-Qwen-2B-Ethiopia', {
|
| 48 |
+
device: 'webgpu',
|
| 49 |
+
});
|
| 50 |
+
status.innerText = "Status: ✅ Ready! Model running on your local GPU.";
|
| 51 |
+
sendBtn.disabled = false;
|
| 52 |
+
} catch (err) {
|
| 53 |
+
status.innerText = "Status: ❌ Error. Make sure you're using Chrome/Edge and have WebGPU enabled.";
|
| 54 |
+
console.error(err);
|
| 55 |
+
}
|
| 56 |
+
};
|
| 57 |
+
|
| 58 |
+
sendBtn.onclick = async () => {
|
| 59 |
+
const text = document.getElementById('input').value;
|
| 60 |
+
if(!text) return;
|
| 61 |
+
|
| 62 |
+
status.innerText = "Status: AI is diagnosing...";
|
| 63 |
+
const output = await generator(text, {
|
| 64 |
+
max_new_tokens: 256,
|
| 65 |
+
temperature: 0.7,
|
| 66 |
+
do_sample: true
|
| 67 |
+
});
|
| 68 |
+
|
| 69 |
+
document.getElementById('result').innerText = output[0].generated_text;
|
| 70 |
+
status.innerText = "Status: ✅ Ready.";
|
| 71 |
+
};
|
| 72 |
+
</script>
|
| 73 |
+
</body>
|
| 74 |
+
</html>
|