gruhit-patel's picture
Initial Commit
5b3feb2 verified
raw
history blame contribute delete
979 Bytes
import streamlit as st
import requests
import json
from io import BytesIO
st.title('COVID-19 Prediction')
st.subheader('Provide an X-ray of lungs and check if you have covid-19, or any other desease or your normal.')
# Take image input
img_file_buffer = st.file_uploader("Upload your chest X-ray")
if img_file_buffer is not None:
# Retrive the file value
img_bytes = img_file_buffer.getvalue()
# Create a payload
files = {"x_ray_image": BytesIO(img_bytes)}
URL = "http://127.0.0.1:8000/get_prediction"
with st.spinner("Waiting for model response..."):
st.write("Came in spinner")
resp = requests.post(
URL,
files = files,
)
st.write("Executed response")
if resp._content is not None:
resp_data = json.loads(resp._content.decode('utf-8'))
st.write(resp_data)
else:
st.write(resp.__dict__)