-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
47 lines (35 loc) · 1.27 KB
/
app.py
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
import streamlit as st
from PIL import Image
import core
def main():
st.title("Upload the PCB Image")
# Upload image
uploaded_file = st.file_uploader(
"Choose an image...", type=["jpg", "jpeg", "png"])
if uploaded_file is not None:
st.write(core.get_system_info())
# Read image
image = Image.open(uploaded_file)
# Display image
st.image(image, caption="Uploaded Image",
width=300,) # , use_column_width=True)
st.write(
f"**Image Details:** Format: {image.format} / Size: {image.size} / Mode: {image.mode}")
with st.spinner("Processing..."):
df, image_Yolo, sam_img = core.process(image, uploaded_file.name)
print("To display")
# Display image
st.image(image_Yolo,
caption="Yolo Detection ",
width=300
) # , use_column_width=True)
# Display image
st.image(sam_img, clamp=True, #channels='BGR',
caption="Sam Segmentation",
width=300
) # , use_column_width=True)
st.dataframe(df)
else:
st.info("Please upload an image file.")
if __name__ == "__main__":
main()