Spaces:
Sleeping
Sleeping
File size: 2,538 Bytes
0ec85cb b03ce14 57f9ae0 b086b76 0ec85cb d894515 0ec85cb 29c7e3d 6376253 fda0273 3e49080 019ad31 95a0a8d fda0273 4a16f7c fda0273 0ec85cb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
from fastai.vision.all import *
import gradio as gr
learn = load_learner('HematoTechModel.pkl')
# Extract categories directly from the learner to ensure correct order
categories = learn.dls.vocab
def classify_img(img):
pred, idx, probs = learn.predict(img)
return {categories[i]: float(probs[i]) for i in range(len(categories))}
image = gr.Image()
labels = gr.Label()
examples = ['Leukemia Cells_allbloodsmear.jpg', 'image_2024-05-28_220024051.png', 'Thalassemia Cells_pathology_thalassemiaminor40x03.jpg']
intf = gr.Interface(
fn=classify_img,
inputs=image,
outputs=labels,
examples=examples,
title='Blood Disease Identifier',
description="Please upload your blood smear image that is greater than 200x magnification to diagnose the patient with the following blood diseases: Sickle Cell Disease, Leukemia, or Thalassemia. <br><br>Please note that the results are not 100% accurate and should only be used as a first means of detection. Please contact a medical professional for more information and possible future action. HematoTech are not liable for any misdiagnosis that may occur.",
allow_flagging=False,
article='Sickle cell disease (SCD) is a group of inherited red blood cell disorders. In SCD, the red blood cells become hard and sticky and look like a C-shaped farm tool called a “sickle.” In their extreme form, and in rare cases, the following conditions could be harmful for people with SCT: Increased atmospheric pressure, low oxygen levels, dehydration, and/or high altitudes. Some symptoms include: yellowish skin, extreme tiredness, painful swelling, and breathing problems. <br><br> Thalassemia is a blood disorder caused when the body doesn’t make enough of a protein called hemoglobin, an important part of red blood cells. Thalassemia is a treatable disorder that can be well-managed with blood transfusions and chelation therapy. Some symptoms include: fatigue, weakness, yellow/pale skin, slow growth, and abnormal swelling. <br><br> Leukemia is a type of cancer that affects the blood and bone marrow. There are four major types of leukemia. Within each type of leukemia, there can be several subtypes. The treatment for leukemia varies significantly according to the type or subtype and whether it progresses quickly (acute) or slowly (chronic). You may find that learning about your diagnosis once you know the type and subtype of leukemia involved will help you better understand the disease and its treatment.'
)
intf.launch(inline=False, share=True) |