Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from fastai.vision.all import *
|
| 3 |
from PIL import Image
|
|
|
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
learn = load_learner('model.pkl')
|
|
@@ -8,7 +10,7 @@ labels = learn.dls.vocab
|
|
| 8 |
input_shape = (512, 512) # Dimensões desejadas para a entrada
|
| 9 |
|
| 10 |
def preprocess_image(img):
|
| 11 |
-
img = Image.
|
| 12 |
img = img.resize(input_shape)
|
| 13 |
return img
|
| 14 |
|
|
@@ -20,7 +22,7 @@ def predict(img):
|
|
| 20 |
|
| 21 |
title = "Tuberculosis detector"
|
| 22 |
description = "A tuberculosis detector trained on 3700 chest X-ray images. Created as a demo for Gradio and HuggingFace Spaces."
|
| 23 |
-
examples = ['1.
|
| 24 |
interpretation = 'default'
|
| 25 |
enable_queue = True
|
| 26 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from fastai.vision.all import *
|
| 3 |
from PIL import Image
|
| 4 |
+
import io
|
| 5 |
+
import numpy as np
|
| 6 |
|
| 7 |
|
| 8 |
learn = load_learner('model.pkl')
|
|
|
|
| 10 |
input_shape = (512, 512) # Dimensões desejadas para a entrada
|
| 11 |
|
| 12 |
def preprocess_image(img):
|
| 13 |
+
img = Image.fromarray(np.uint8(img))
|
| 14 |
img = img.resize(input_shape)
|
| 15 |
return img
|
| 16 |
|
|
|
|
| 22 |
|
| 23 |
title = "Tuberculosis detector"
|
| 24 |
description = "A tuberculosis detector trained on 3700 chest X-ray images. Created as a demo for Gradio and HuggingFace Spaces."
|
| 25 |
+
examples = ['1.jpeg', '2.jpeg', '3.jpeg', '4.jpeg']
|
| 26 |
interpretation = 'default'
|
| 27 |
enable_queue = True
|
| 28 |
|