Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,10 +38,7 @@ if uploaded_file is not None:
|
|
| 38 |
break
|
| 39 |
|
| 40 |
|
| 41 |
-
|
| 42 |
-
# label="Download Processed Video",
|
| 43 |
-
# data=csv,
|
| 44 |
-
# file_name='output.mp4')
|
| 45 |
|
| 46 |
cv2.destroyAllWindows()
|
| 47 |
output.release()
|
|
@@ -49,52 +46,9 @@ if uploaded_file is not None:
|
|
| 49 |
|
| 50 |
# Get the base64 encoded content of the video file
|
| 51 |
video_base64 = get_video_content_as_base64('output.mp4')
|
| 52 |
-
|
| 53 |
-
# Create a download button
|
| 54 |
-
st.markdown(
|
| 55 |
-
f'<a href="data:video/mp4;base64,{video_base64}" download="your_video.mp4">Download video</a>',
|
| 56 |
-
unsafe_allow_html=True,
|
| 57 |
-
)
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
# @st.cache(allow_output_mutation=True)
|
| 61 |
-
# def get_cap(location):
|
| 62 |
-
# print("Loading in function", str(location))
|
| 63 |
-
# video_stream = cv2.VideoCapture(str(location))
|
| 64 |
-
|
| 65 |
-
# # Check if camera opened successfully
|
| 66 |
-
# if (video_stream.isOpened() == False):
|
| 67 |
-
# print("Error opening video file")
|
| 68 |
-
# return video_stream
|
| 69 |
-
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
# while True:
|
| 77 |
-
# # here it is a CV2 object
|
| 78 |
-
# video_stream = get_cap(temporary_location)
|
| 79 |
-
# # video_stream = video_stream.read()
|
| 80 |
-
# ret, image = video_stream.read()
|
| 81 |
-
# if ret:
|
| 82 |
-
# image = cv2.resize(image, None, fx=scaling_factorx, fy=scaling_factory, interpolation=cv2.INTER_AREA)
|
| 83 |
-
# else:
|
| 84 |
-
# print("there was a problem or video was finished")
|
| 85 |
-
# cv2.destroyAllWindows()
|
| 86 |
-
# video_stream.release()
|
| 87 |
-
# break
|
| 88 |
-
# # check if frame is None
|
| 89 |
-
# if image is None:
|
| 90 |
-
# print("there was a problem None")
|
| 91 |
-
# # if True break the infinite loop
|
| 92 |
-
# break
|
| 93 |
-
|
| 94 |
-
# image_placeholder.image(image, channels="BGR", use_column_width=True)
|
| 95 |
-
|
| 96 |
-
# cv2.destroyAllWindows()
|
| 97 |
-
# video_stream.release()
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
# cv2.destroyAllWindows()
|
|
|
|
| 38 |
break
|
| 39 |
|
| 40 |
|
| 41 |
+
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
cv2.destroyAllWindows()
|
| 44 |
output.release()
|
|
|
|
| 46 |
|
| 47 |
# Get the base64 encoded content of the video file
|
| 48 |
video_base64 = get_video_content_as_base64('output.mp4')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
+
st.download_button(
|
| 51 |
+
label="Download Processed Video",
|
| 52 |
+
data=video_base64,
|
| 53 |
+
file_name='output.mp4')
|
| 54 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|