Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,6 +19,9 @@ st.set_page_config(layout="wide")
|
|
| 19 |
|
| 20 |
clearEphimeral()
|
| 21 |
|
|
|
|
|
|
|
|
|
|
| 22 |
detector = pipeline("object-detection", model="sergioska/yolo-finetuned-flyers")
|
| 23 |
|
| 24 |
st.title('Upload an image file to detection')
|
|
@@ -36,7 +39,7 @@ with col1:
|
|
| 36 |
|
| 37 |
imageLocation = st.empty()
|
| 38 |
|
| 39 |
-
if uploaded_image_zero_file is not None:
|
| 40 |
image = Image.open(uploaded_image_zero_file)
|
| 41 |
outputImage = np.array(image)
|
| 42 |
predictions = detector(
|
|
@@ -45,7 +48,7 @@ with col1:
|
|
| 45 |
)
|
| 46 |
imageLocation.image(outputImage)
|
| 47 |
|
| 48 |
-
if st.button('detect'):
|
| 49 |
|
| 50 |
draw = ImageDraw.Draw(image)
|
| 51 |
|
|
@@ -69,6 +72,7 @@ with col1:
|
|
| 69 |
|
| 70 |
totalGibs = i
|
| 71 |
gibsOk = True
|
|
|
|
| 72 |
imageLocation.image(image)
|
| 73 |
st.write(predictions)
|
| 74 |
|
|
|
|
| 19 |
|
| 20 |
clearEphimeral()
|
| 21 |
|
| 22 |
+
if 'wip' not in st.session_state:
|
| 23 |
+
st.session_state['wip'] = False
|
| 24 |
+
|
| 25 |
detector = pipeline("object-detection", model="sergioska/yolo-finetuned-flyers")
|
| 26 |
|
| 27 |
st.title('Upload an image file to detection')
|
|
|
|
| 39 |
|
| 40 |
imageLocation = st.empty()
|
| 41 |
|
| 42 |
+
if uploaded_image_zero_file is not None and !st.session_state['wip']:
|
| 43 |
image = Image.open(uploaded_image_zero_file)
|
| 44 |
outputImage = np.array(image)
|
| 45 |
predictions = detector(
|
|
|
|
| 48 |
)
|
| 49 |
imageLocation.image(outputImage)
|
| 50 |
|
| 51 |
+
if st.button('detect') and !st.session_state['wip']:
|
| 52 |
|
| 53 |
draw = ImageDraw.Draw(image)
|
| 54 |
|
|
|
|
| 72 |
|
| 73 |
totalGibs = i
|
| 74 |
gibsOk = True
|
| 75 |
+
st.session_state['wip'] = True
|
| 76 |
imageLocation.image(image)
|
| 77 |
st.write(predictions)
|
| 78 |
|