push app
Browse files
app.py
CHANGED
|
@@ -177,18 +177,22 @@ else:
|
|
| 177 |
# Prompt input for inpainting
|
| 178 |
prompt = st.text_input("Prompt for inpainting (describe what should replace the selected area):")
|
| 179 |
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
#
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
# Prompt input for inpainting
|
| 178 |
prompt = st.text_input("Prompt for inpainting (describe what should replace the selected area):")
|
| 179 |
|
| 180 |
+
# --- 4) INPAINTING LOGIC ---
|
| 181 |
+
prompt = st.text_input("Prompt for inpainting (describe what should replace the selected area):")
|
| 182 |
+
|
| 183 |
+
# If there's a prompt and we have at least one mask from the combined points, do inpainting
|
| 184 |
+
if prompt and combined_mask_img is not None:
|
| 185 |
+
if st.button("Run Inpainting"):
|
| 186 |
+
with st.spinner("Inpainting..."):
|
| 187 |
+
# Run Stable Diffusion Inpainting on the entire combined mask
|
| 188 |
+
inpainted_img = sd_pipe(
|
| 189 |
+
prompt=prompt,
|
| 190 |
+
image=img,
|
| 191 |
+
mask_image=combined_mask_img
|
| 192 |
+
).images[0]
|
| 193 |
+
|
| 194 |
+
# Update the session image to the newly inpainted result
|
| 195 |
+
st.session_state.img = inpainted_img
|
| 196 |
+
# Optionally reset the points or keep them
|
| 197 |
+
st.session_state.coords_list = []
|
| 198 |
+
st.rerun()
|