Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,38 +1,13 @@
|
|
| 1 |
-
# This Python 3 environment comes with many helpful analytics libraries installed
|
| 2 |
-
# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python
|
| 3 |
-
# For example, here's several helpful packages to load
|
| 4 |
-
|
| 5 |
-
import numpy as np # linear algebra
|
| 6 |
-
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
|
| 7 |
-
|
| 8 |
-
# Input data files are available in the read-only "../input/" directory
|
| 9 |
-
# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory
|
| 10 |
-
|
| 11 |
-
import os
|
| 12 |
-
for dirname, _, filenames in os.walk('/kaggle/input'):
|
| 13 |
-
for filename in filenames:
|
| 14 |
-
print(os.path.join(dirname, filename))
|
| 15 |
-
|
| 16 |
-
# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using "Save & Run All"
|
| 17 |
-
# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
RUN pip install -Uqq fastai
|
| 21 |
import gradio as gr
|
| 22 |
-
from fastai.vision.all import*
|
| 23 |
-
categories = ('Healthy Cell', 'Leukemia', 'Sickle Cell', 'Thalassemia')
|
| 24 |
-
def classify_image(img):
|
| 25 |
-
pred,idx,probs = learn.predict(img)
|
| 26 |
-
return dict(zip(categories, map(float,probs)))
|
| 27 |
|
| 28 |
# Assuming no shape needs to be specified directly in the constructor
|
| 29 |
image = gr.Image()
|
| 30 |
label = gr.Label()
|
| 31 |
examples = [
|
| 32 |
-
'
|
| 33 |
-
'
|
| 34 |
-
'
|
| 35 |
-
'
|
| 36 |
]
|
| 37 |
|
| 38 |
intf = gr.Interface(
|
|
@@ -41,10 +16,10 @@ intf = gr.Interface(
|
|
| 41 |
outputs=label,
|
| 42 |
examples=examples,
|
| 43 |
title='Blood Disease Identifier',
|
| 44 |
-
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.
|
| 45 |
allow_flagging=False,
|
| 46 |
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.” The disease can be managed under proper medical supervision.'
|
| 47 |
)
|
| 48 |
|
| 49 |
# Launch the interface
|
| 50 |
-
intf.launch(inline=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
# Assuming no shape needs to be specified directly in the constructor
|
| 4 |
image = gr.Image()
|
| 5 |
label = gr.Label()
|
| 6 |
examples = [
|
| 7 |
+
'/kaggle/input/leukemia-cells/allbloodsmear.jpg',
|
| 8 |
+
'/kaggle/input/cells-of-sickle/650x450-Sickle-Cell-Trait.jpg',
|
| 9 |
+
'/kaggle/input/cells-of-sickle/Sickle Cell Anemia smear 40x.jpg',
|
| 10 |
+
'/kaggle/input/healthy-cells/normalbloodsmear.jpg'
|
| 11 |
]
|
| 12 |
|
| 13 |
intf = gr.Interface(
|
|
|
|
| 16 |
outputs=label,
|
| 17 |
examples=examples,
|
| 18 |
title='Blood Disease Identifier',
|
| 19 |
+
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.",
|
| 20 |
allow_flagging=False,
|
| 21 |
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.” The disease can be managed under proper medical supervision.'
|
| 22 |
)
|
| 23 |
|
| 24 |
# Launch the interface
|
| 25 |
+
intf.launch(inline=False)
|