#%% 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}")