Update app.py
Browse files
app.py
CHANGED
|
@@ -69,7 +69,7 @@ def swap_faces(destination_image, source_image):
|
|
| 69 |
sharpened_res = cv2.filter2D(res, -1, kernel)
|
| 70 |
|
| 71 |
# Commented smoothing (blurring) for testing purposes
|
| 72 |
-
|
| 73 |
|
| 74 |
# Convert the result to RGB for display in Streamlit
|
| 75 |
sharpened_res_rgb = cv2.cvtColor(sharpened_res, cv2.COLOR_BGR2RGB)
|
|
@@ -78,7 +78,7 @@ def swap_faces(destination_image, source_image):
|
|
| 78 |
|
| 79 |
# Streamlit app layout
|
| 80 |
def main():
|
| 81 |
-
st.set_page_config(page_title="
|
| 82 |
|
| 83 |
# CSS for styling
|
| 84 |
st.markdown("""
|
|
@@ -99,14 +99,14 @@ def main():
|
|
| 99 |
""", unsafe_allow_html=True)
|
| 100 |
|
| 101 |
# Page Header (outside sidebar)
|
| 102 |
-
st.header("
|
| 103 |
st.write("Welcome to the face swapping app! Upload two images and watch the magic happen!")
|
| 104 |
|
| 105 |
# Sidebar for file uploads and instructions
|
| 106 |
with st.sidebar:
|
| 107 |
-
st.subheader("Upload Images for Face Swapping")
|
| 108 |
-
destination_image = st.file_uploader("Upload Destination Image", type=["jpg", "png", "jpeg"])
|
| 109 |
source_image = st.file_uploader("Upload Source Image", type=["jpg", "png", "jpeg"])
|
|
|
|
| 110 |
|
| 111 |
if destination_image and source_image:
|
| 112 |
# Check if destination image contains adult content
|
|
@@ -142,7 +142,7 @@ def main():
|
|
| 142 |
st.image(st.session_state.result, caption="Swapped Face", use_container_width=True)
|
| 143 |
|
| 144 |
# Footer with credits
|
| 145 |
-
st.markdown("Developed with ❤ by
|
| 146 |
|
| 147 |
# Run the app
|
| 148 |
if __name__ == '__main__':
|
|
|
|
| 69 |
sharpened_res = cv2.filter2D(res, -1, kernel)
|
| 70 |
|
| 71 |
# Commented smoothing (blurring) for testing purposes
|
| 72 |
+
smoothed_res = cv2.GaussianBlur(res, (5, 5), 0)
|
| 73 |
|
| 74 |
# Convert the result to RGB for display in Streamlit
|
| 75 |
sharpened_res_rgb = cv2.cvtColor(sharpened_res, cv2.COLOR_BGR2RGB)
|
|
|
|
| 78 |
|
| 79 |
# Streamlit app layout
|
| 80 |
def main():
|
| 81 |
+
st.set_page_config(page_title="SnapSwap", page_icon=":camera:")
|
| 82 |
|
| 83 |
# CSS for styling
|
| 84 |
st.markdown("""
|
|
|
|
| 99 |
""", unsafe_allow_html=True)
|
| 100 |
|
| 101 |
# Page Header (outside sidebar)
|
| 102 |
+
st.header("SnapSwap :camera:")
|
| 103 |
st.write("Welcome to the face swapping app! Upload two images and watch the magic happen!")
|
| 104 |
|
| 105 |
# Sidebar for file uploads and instructions
|
| 106 |
with st.sidebar:
|
| 107 |
+
st.subheader("Upload Images for Face Swapping and hit Swap Faces button")
|
|
|
|
| 108 |
source_image = st.file_uploader("Upload Source Image", type=["jpg", "png", "jpeg"])
|
| 109 |
+
destination_image = st.file_uploader("Upload Destination Image", type=["jpg", "png", "jpeg"])
|
| 110 |
|
| 111 |
if destination_image and source_image:
|
| 112 |
# Check if destination image contains adult content
|
|
|
|
| 142 |
st.image(st.session_state.result, caption="Swapped Face", use_container_width=True)
|
| 143 |
|
| 144 |
# Footer with credits
|
| 145 |
+
st.markdown("Developed with ❤ by Bucky")
|
| 146 |
|
| 147 |
# Run the app
|
| 148 |
if __name__ == '__main__':
|