Spaces:
Runtime error
Runtime error
import os | |
import streamlit as st | |
def input_image_setup(uploaded_file): | |
if uploaded_file is not None: | |
#read te file into byte | |
bytes_data = uploaded_file.getvalue() | |
image_parts=[ | |
{ | |
"mime_type": uploaded_file.type, | |
"data": bytes_data | |
} | |
] | |
return image_parts | |
else: | |
raise FileNotFoundError("No file uploaded") | |
#Streamlit App | |
st.set_page_config(page_title="Image Detection") | |
st.header("Object Detection Application") | |
uploaded_file = st.file_uploader("choose an image...", type=["jpg","jpeg","png"]) | |
image="" | |
if uploaded_file is not None: | |
image = Image.open(uploaded_file) | |
st.image(image, caption="Uploaded Image.", use_column_width=True) | |
submit = st.button("Detect Objects ") | |
if submit: | |
image_data=input_image_setup(uploaded_file) | |
st.subheader("The response is..") | |
st.write(response) | |