bsant576/tensorflow_pract
0
1#%%2import plotly.express as px3import numpy as np4import pandas as pd5import streamlit as st6import tensorflow as tf7from keras.preprocessing import image8#docker build -t streamlit9# docker compose up10image_file_prev = ""11model = tf.keras.models.load_model("cnnBoneFracRec.h5")12st.markdown("## Bone Fracture Recognition with TensorFlow")13 14 15image_file = st.file_uploader("Upload X-Ray Image", type=['png', 'jpg'])16 17if image_file_prev != image_file and image_file:18 st.image(image_file, caption=None, width=None, use_column_width=None, clamp=False, channels="RGB", output_format="auto")19 image_file_prev = image_file20 target_names = ['Non-Fractured', 'Fractured']21 temp_img = image.load_img(image_file, target_size=(100, 100))22 x = image.img_to_array(temp_img)23 x = np.expand_dims(x, axis=0)24 images = np.vstack([x])25 prediction = np.argmax(model.predict(images), axis=1)26 27 prediction_str = target_names[prediction.item()]28 29 if prediction_str:30 st.markdown(f"##### Prediction : {prediction_str}")31 