Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -76,10 +76,12 @@ with col1:
|
|
| 76 |
with col2:
|
| 77 |
st.header('gibs')
|
| 78 |
images = []
|
|
|
|
| 79 |
for cropped in glob.glob('/tmp/cropped_image_*'):
|
| 80 |
with open(cropped, "rb") as image:
|
| 81 |
encoded = base64.b64encode(image.read()).decode()
|
| 82 |
images.append(f"data:image/jpeg;base64,{encoded}")
|
|
|
|
| 83 |
clicked = clickable_images(
|
| 84 |
images,
|
| 85 |
titles=[f"Image #{str(i)}" for i in range(totalGibs)],
|
|
@@ -88,8 +90,17 @@ with col2:
|
|
| 88 |
key="cropped_images"
|
| 89 |
)
|
| 90 |
|
|
|
|
|
|
|
| 91 |
if gibsOk:
|
| 92 |
detectorForContents = pipeline("object-detection", model="sergioska/yolo-finetuned-flyers-content")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
|
| 95 |
st.markdown(f"Image #{clicked} clicked" if clicked > -1 else "No image clicked")
|
|
|
|
| 76 |
with col2:
|
| 77 |
st.header('gibs')
|
| 78 |
images = []
|
| 79 |
+
imagesForOpen = []
|
| 80 |
for cropped in glob.glob('/tmp/cropped_image_*'):
|
| 81 |
with open(cropped, "rb") as image:
|
| 82 |
encoded = base64.b64encode(image.read()).decode()
|
| 83 |
images.append(f"data:image/jpeg;base64,{encoded}")
|
| 84 |
+
imagesForOpen.append(image)
|
| 85 |
clicked = clickable_images(
|
| 86 |
images,
|
| 87 |
titles=[f"Image #{str(i)}" for i in range(totalGibs)],
|
|
|
|
| 90 |
key="cropped_images"
|
| 91 |
)
|
| 92 |
|
| 93 |
+
with col3:
|
| 94 |
+
st.header('details')
|
| 95 |
if gibsOk:
|
| 96 |
detectorForContents = pipeline("object-detection", model="sergioska/yolo-finetuned-flyers-content")
|
| 97 |
+
imageForDetails = Image.open(imagesForOpen[0])
|
| 98 |
+
outputImageForDetails = np.array(imageForDetails)
|
| 99 |
+
predictions = detectorForContents(
|
| 100 |
+
imageForDetails,
|
| 101 |
+
candidate_labels=['product']
|
| 102 |
+
)
|
| 103 |
+
st.write(predictions)
|
| 104 |
|
| 105 |
|
| 106 |
st.markdown(f"Image #{clicked} clicked" if clicked > -1 else "No image clicked")
|