Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
def input_image_setup(uploaded_file):
|
2 |
+
if uploaded_file is not None:
|
3 |
+
#read te file into byte
|
4 |
+
bytes_data = uploaded_file.getvalue()
|
5 |
+
image_parts=[
|
6 |
+
{
|
7 |
+
"mime_type": uploaded_file.type,
|
8 |
+
"data": bytes_data
|
9 |
+
}
|
10 |
+
]
|
11 |
+
return image_parts
|
12 |
+
else:
|
13 |
+
raise FileNotFoundError("No file uploaded")
|
14 |
+
|
15 |
+
#Streamlit App
|
16 |
+
st.set_page_config(page_title="Image Detection")
|
17 |
+
st.header("Object Detection Application")
|
18 |
+
uploaded_file = st.file_uploader("choose an image...", type=["jpg","jpeg","png"])
|
19 |
+
image=""
|
20 |
+
if uploaded_file is not None:
|
21 |
+
image = Image.open(uploaded_file)
|
22 |
+
st.image(image, caption="Uploaded Image.", use_column_width=True)
|
23 |
+
submit = st.button("Detect Objects ")
|
24 |
+
|
25 |
+
if submit:
|
26 |
+
image_data=input_image_setup(uploaded_file)
|
27 |
+
|
28 |
+
st.subheader("The response is..")
|
29 |
+
st.write(response)
|