Skip to content

Kyl branch #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,067 changes: 883 additions & 184 deletions 02_Inference_SAM_PCBQualityControl.ipynb

Large diffs are not rendered by default.

53 changes: 34 additions & 19 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@


def main():
st.title("Upload the PCB Image")
st.title("PCB Hole qualification")

# Upload image
uploaded_file = st.file_uploader(
"Choose an image...", type=["jpg", "jpeg", "png"])

"Upload a PBC image...", type=["jpg", "jpeg", "png"])
results=[]
if uploaded_file is not None:
st.write(core.get_system_info())
# Read image
Expand All @@ -20,27 +20,42 @@ def main():
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)
results.append([df, image_Yolo, sam_img])
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.")
st.info("Please upload an image file.")

option = st.selectbox(
'Choose segmentation method',
('YOLO', 'SAM'))

try:
if option=='YOLO':
# Display image
st.image(results[0][1],
caption="Yolo Detection ",
width=300
) # , use_column_width=True)

elif option=='SAM':
# Display image
st.image(results[0][2], clamp=True, #channels='BGR',
caption="Sam Segmentation",
width=300
) # , use_column_width=True)
if st.button('Show Dataframe'):
st.dataframe(results[0][0])
else:
st.write('No dataframe to display. Upload a PBC image and restart the process')

except:
st.write('Upload an imaage first please!')



if __name__ == "__main__":
Expand Down