File size: 1,022 Bytes
ea5b7d5
59a2d05
ea5b7d5
 
 
 
 
 
 
59a2d05
ea5b7d5
59a2d05
 
 
ea5b7d5
 
59a2d05
ea5b7d5
59a2d05
ea5b7d5
 
5d64005
 
ea5b7d5
 
 
 
 
 
 
5d64005
ea5b7d5
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#%%
import plotly.express as px
import numpy as np
import pandas as pd
import streamlit as st
import tensorflow as tf
from keras.preprocessing import image
#docker build -t streamlit
# docker compose up

st.markdown("## Bone Fracture Recognition with TensorFlow")



# actu_loc = [actu + f"_{loc}" for loc in locations]
# fore_loc = [fore + f"_{loc}" for loc in locations]

image_file = st.file_uploader("Upload X-Ray Image", type=['png', 'jpg'])

if image_file:
    st.image(image_file, caption=None, width=None, use_column_width=None, clamp=False, channels="RGB", output_format="auto")


model = tf.keras.models.load_model("cnnBoneFracRec.h5")
target_names = ['Non-Fractured', 'Fractured']
temp_img = image.load_img(image_file, target_size=(100, 100))
x = image.img_to_array(temp_img)
x = np.expand_dims(x, axis=0)
images = np.vstack([x])
prediction = np.argmax(model.predict(images), axis=1)

prediction_str = target_names[prediction.item()]
7
if prediction_str:
    st.markdown(f"##### Prediction : {prediction_str}")