Update app.py
Browse files
app.py
CHANGED
|
@@ -68,12 +68,19 @@ def main():
|
|
| 68 |
</style>
|
| 69 |
""", unsafe_allow_html=True)
|
| 70 |
|
| 71 |
-
# Page Header
|
| 72 |
st.header("Face Swapping App :camera:")
|
| 73 |
st.write("Welcome to the face swapping app! Upload two images and watch the magic happen!")
|
| 74 |
|
| 75 |
-
# Sidebar for file uploads
|
| 76 |
with st.sidebar:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
st.subheader("Upload Images for Face Swapping")
|
| 78 |
destination_image = st.file_uploader("Upload Destination Image", type=["jpg", "png", "jpeg"])
|
| 79 |
source_image = st.file_uploader("Upload Source Image", type=["jpg", "png", "jpeg"])
|
|
@@ -92,16 +99,12 @@ def main():
|
|
| 92 |
if isinstance(result, str):
|
| 93 |
st.error(result) # Display error message if no faces detected or memory error
|
| 94 |
else:
|
| 95 |
-
st.
|
| 96 |
st.success("Face swapping complete!")
|
| 97 |
|
| 98 |
-
#
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
1. **Upload the destination and source images**: Select the images you want to use for face swapping.
|
| 102 |
-
2. **Click on the "Swap Faces" button**: The app will process the images and swap the faces.
|
| 103 |
-
3. **View the output**: The swapped face image will appear below after processing.
|
| 104 |
-
""")
|
| 105 |
|
| 106 |
# Footer with credits
|
| 107 |
st.markdown("Developed with ❤ by [Your Name]")
|
|
|
|
| 68 |
</style>
|
| 69 |
""", unsafe_allow_html=True)
|
| 70 |
|
| 71 |
+
# Page Header (outside sidebar)
|
| 72 |
st.header("Face Swapping App :camera:")
|
| 73 |
st.write("Welcome to the face swapping app! Upload two images and watch the magic happen!")
|
| 74 |
|
| 75 |
+
# Sidebar for instructions and file uploads
|
| 76 |
with st.sidebar:
|
| 77 |
+
st.subheader("How to Use the App:")
|
| 78 |
+
st.markdown("""
|
| 79 |
+
1. **Upload the destination and source images**: Select the images you want to use for face swapping.
|
| 80 |
+
2. **Click on the "Swap Faces" button**: The app will process the images and swap the faces.
|
| 81 |
+
3. **View the output**: The swapped face image will appear below after processing.
|
| 82 |
+
""")
|
| 83 |
+
|
| 84 |
st.subheader("Upload Images for Face Swapping")
|
| 85 |
destination_image = st.file_uploader("Upload Destination Image", type=["jpg", "png", "jpeg"])
|
| 86 |
source_image = st.file_uploader("Upload Source Image", type=["jpg", "png", "jpeg"])
|
|
|
|
| 99 |
if isinstance(result, str):
|
| 100 |
st.error(result) # Display error message if no faces detected or memory error
|
| 101 |
else:
|
| 102 |
+
st.session_state.result = result # Save the result in session state
|
| 103 |
st.success("Face swapping complete!")
|
| 104 |
|
| 105 |
+
# Main content area for displaying the swapped face image
|
| 106 |
+
if 'result' in st.session_state:
|
| 107 |
+
st.image(st.session_state.result, caption="Swapped Face", use_container_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
# Footer with credits
|
| 110 |
st.markdown("Developed with ❤ by [Your Name]")
|