Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,17 +1,12 @@
|
|
1 |
import gradio as gr
|
2 |
-
import
|
3 |
-
from torchvision import models
|
4 |
-
from tensorflow.keras.models import load_model
|
5 |
import numpy as np
|
6 |
import os
|
7 |
|
8 |
-
|
9 |
-
# os.system("tar -zxvf examples.tar.gz")
|
10 |
-
|
11 |
-
model = load_model('model_cv.h5')
|
12 |
|
13 |
def detect(img):
|
14 |
-
img = img.reshape(1,100,100,3)
|
15 |
prediction = np.around(model.predict(img)[0], decimals=0)[0]
|
16 |
|
17 |
if prediction == 1:
|
@@ -20,7 +15,7 @@ def detect(img):
|
|
20 |
return "Pneumonia Not Detected!"
|
21 |
|
22 |
|
23 |
-
input = gr.inputs.Image(shape=(100,100))
|
24 |
|
25 |
examples = ['examples/n1.jpeg', 'examples/n2.jpeg', 'examples/n3.jpeg', 'examples/n4.jpeg', 'examples/n5.jpeg',
|
26 |
'examples/n6.jpeg', 'examples/n7.jpeg', 'examples/n8.jpeg', 'examples/p6.jpeg', 'examples/p7.jpeg',
|
@@ -31,6 +26,7 @@ title = "PneumoDetect: Pneumonia Detection from Chest X-Rays"
|
|
31 |
iface = gr.Interface(fn=detect, inputs=input, outputs="text", examples=examples, examples_per_page=20, title=title)
|
32 |
iface.launch(inline=False)
|
33 |
|
|
|
34 |
# model_name = "Horus7/kaduce" # Remplacez par le nom de votre modèle Hugging Face
|
35 |
|
36 |
# # tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
|
1 |
import gradio as gr
|
2 |
+
import tensorflow as tf
|
|
|
|
|
3 |
import numpy as np
|
4 |
import os
|
5 |
|
6 |
+
model = tf.keras.models.load_model('model_cv.h5')
|
|
|
|
|
|
|
7 |
|
8 |
def detect(img):
|
9 |
+
img = img.reshape(1, 100, 100, 3)
|
10 |
prediction = np.around(model.predict(img)[0], decimals=0)[0]
|
11 |
|
12 |
if prediction == 1:
|
|
|
15 |
return "Pneumonia Not Detected!"
|
16 |
|
17 |
|
18 |
+
input = gr.inputs.Image(shape=(100, 100))
|
19 |
|
20 |
examples = ['examples/n1.jpeg', 'examples/n2.jpeg', 'examples/n3.jpeg', 'examples/n4.jpeg', 'examples/n5.jpeg',
|
21 |
'examples/n6.jpeg', 'examples/n7.jpeg', 'examples/n8.jpeg', 'examples/p6.jpeg', 'examples/p7.jpeg',
|
|
|
26 |
iface = gr.Interface(fn=detect, inputs=input, outputs="text", examples=examples, examples_per_page=20, title=title)
|
27 |
iface.launch(inline=False)
|
28 |
|
29 |
+
|
30 |
# model_name = "Horus7/kaduce" # Remplacez par le nom de votre modèle Hugging Face
|
31 |
|
32 |
# # tokenizer = AutoTokenizer.from_pretrained(model_name)
|