Spaces:
Runtime error
Runtime error
joybangla71 commited on
Commit ·
772a7f8
1
Parent(s): 2e56759
updated app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastai.vision.all import *
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
learn = load_learner('model.pkl')
|
| 5 |
+
labels = learn.dls.vocab
|
| 6 |
+
def predict(img):
|
| 7 |
+
img = PILImage.create(img)
|
| 8 |
+
pred,pred_idx,probs = learn.predict(img)
|
| 9 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 10 |
|
| 11 |
+
title = "Tuberculosis detector"
|
| 12 |
+
description = "A tuberculsosis detector trained on 3700 chest xray images. Created as a demo for Gradio and HuggingFace Spaces."
|
| 13 |
+
# examples = ['fogsmog.jpeg', 'frost.jpeg', 'glaze.jpeg', 'hail.jpeg', 'rain.jpeg', 'rainbow.jpeg', 'snow.jpeg']
|
| 14 |
+
interpretation='default'
|
| 15 |
+
enable_queue=True
|
| 16 |
+
|
| 17 |
+
gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=2),title=title,description=description,interpretation=interpretation,enable_queue=enable_queue).launch(share=True)
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0325ba07b04747d0224c8b26dbae0d438d22d7fcbfe72eda5a2af1aafa9f16f8
|
| 3 |
+
size 47026731
|