Update app.py
Browse files
app.py
CHANGED
|
@@ -99,8 +99,21 @@ if st.button("Swap Faces"):
|
|
| 99 |
|
| 100 |
if output_video_path:
|
| 101 |
st.success("Face swapping completed!")
|
|
|
|
| 102 |
st.video(output_video_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
os.remove(tmp_video_path) # Clean up temporary video file
|
| 104 |
-
|
|
|
|
| 105 |
else:
|
| 106 |
st.error("Please upload both an image and a video.")
|
|
|
|
| 99 |
|
| 100 |
if output_video_path:
|
| 101 |
st.success("Face swapping completed!")
|
| 102 |
+
# Play the processed video in Streamlit
|
| 103 |
st.video(output_video_path)
|
| 104 |
+
|
| 105 |
+
# Provide an option to download the processed video
|
| 106 |
+
with open(output_video_path, "rb") as f:
|
| 107 |
+
st.download_button(
|
| 108 |
+
label="Download Processed Video",
|
| 109 |
+
data=f,
|
| 110 |
+
file_name="output_swapped_video.avi",
|
| 111 |
+
mime="video/x-msvideo"
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
+
# Clean up temporary files
|
| 115 |
os.remove(tmp_video_path) # Clean up temporary video file
|
| 116 |
+
# Optionally, keep the output video after displaying
|
| 117 |
+
# os.remove(output_video_path) # Uncomment to delete after displaying
|
| 118 |
else:
|
| 119 |
st.error("Please upload both an image and a video.")
|