Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import gradio as gr
|
3 |
+
from huggingface_hub import from_pretrained_keras
|
4 |
+
|
5 |
+
def infer(filepath):
|
6 |
+
image_tensor = np.load(filepath)
|
7 |
+
prediction = model.predict(np.expand_dims(image_tensor, axis=0))[0]
|
8 |
+
confidence = 100 * (1 - prediction[0])
|
9 |
+
return confidence
|
10 |
+
|
11 |
+
model = from_pretrained_keras('jalFaizy/3D_CNN')
|
12 |
+
|
13 |
+
filepath = gr.inputs.File()
|
14 |
+
text = gr.outputs.Textbox()
|
15 |
+
|
16 |
+
iface = gr.Interface(
|
17 |
+
infer,
|
18 |
+
filepath,
|
19 |
+
text,
|
20 |
+
title='3D CNN for CT scans',
|
21 |
+
examples=['example_1_normal.npy']
|
22 |
+
)
|
23 |
+
|
24 |
+
iface.launch()
|