Spaces:
Runtime error
Runtime error
File size: 1,428 Bytes
c9f727d 14f0aba c9f727d 11eb784 14f0aba c9f727d 0122017 c9f727d adeb073 105b4db c9f727d 9988273 38260f6 9988273 c9f727d 38260f6 ce93a42 c9f727d ce93a42 c9f727d 9e61e8c c9f727d ac90d96 14f0aba 45c378e c9f727d 38260f6 14f0aba |
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
import io
import os
import numpy as np
import streamlit as st
import requests
from PIL import Image
from model import bone_frac
import cv2
@st.cache(allow_output_mutation=True)
# def get_model():
# return bone_frac()
# pred_model = get_model()
# pred_model=bone_frac()
def predict():
c=bone_frac('tmp.jpg')
st.markdown('#### Prediction:')
st.write(c)
st.title('Bone Fracture Detection')
# img_url = st.text_input(label='Enter Image URL')
# if (img_url != "") and (img_url != None):
# img = Image.open(requests.get(img_url, stream=True).raw)
# img = img.convert('RGB')
# st.image(img)
# img.save('tmp.jpg')
# predict()
# os.remove('tmp.jpg')
hide_streamlit_style = """
<style>
#MainMenu {visibility: hidden;}
footer {visibility: hidden;}
</style>
"""
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
# st.markdown('<center style="opacity: 70%">OR</center>', unsafe_allow_html=True)
img_upload = st.file_uploader(label='Upload Image', type=['jpg', 'png', 'jpeg'])
if img_upload != None:
img = img_upload.read()
img = Image.open(io.BytesIO(img))
img = img.convert('RGB')
img=np.asarray(img)
print(img)
# img=cv2.imread(img)
# img.save('tmp.jpg')
st.image(img)
c=bone_frac(img)
st.markdown('#### Predicted Captions:')
st.write(c)
# predict()
# os.remove('tmp.jpg') |