Beasto's picture
Create app.py
4d437f4
raw
history blame contribute delete
699 Bytes
import streamlit as st
import tensorflow as tf
import numpy as np
from PIL import Image
import tensorflow as tf
def model_out(model_path,img):
model = tf.keras.models.load_model(model_path)
img = (img-127.5)/127.5
img = np.expand_dims(img, 0)
pred = model.predict(img)
pred = np.asarray(pred)
return pred[0]
st.title("Xray Image Enhancer 'Doesnt work well' Pix2Pix")
face_input = st.file_uploader("Image input")
if face_input is not None:
img = Image.open(face_input)
img = img.resize((256, 256))
img = np.array(img)
pred = model_out('XrayEnhancer.h5', img)
st.image(img, caption="Uploaded Image")
st.image(((pred + 1) * 127.5).astype(np.uint8), caption="Enhanced Images")