Spaces:
Running
Running
salomonsky
commited on
Commit
•
35f506c
1
Parent(s):
8c36a1f
Update app.py
Browse files
app.py
CHANGED
@@ -142,11 +142,10 @@ def delete_image(image_path):
|
|
142 |
|
143 |
def swap_faces(image_path):
|
144 |
try:
|
145 |
-
|
146 |
-
|
147 |
-
return result[1] if isinstance(result, list) and len(result) > 1 else None
|
148 |
except Exception as e:
|
149 |
-
st.error(f"Error en el
|
150 |
return None
|
151 |
|
152 |
def main():
|
@@ -203,21 +202,13 @@ def main():
|
|
203 |
st.image(image, caption=f"Imagen {idx+1}")
|
204 |
st.write(f"Prompt: {prompt_text}")
|
205 |
|
206 |
-
if st.button(f"Borrar Imagen {idx+1}", key=f"delete_{idx}"):
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
if st.button(f"Swap Face {idx+1}", key=f"swap_{idx}"):
|
214 |
-
with st.spinner(f"Swapping faces en Imagen {idx+1}..."):
|
215 |
-
swapped_image_path = swap_faces(file)
|
216 |
-
if swapped_image_path:
|
217 |
-
swapped_image = Image.open(swapped_image_path)
|
218 |
-
st.image(swapped_image, caption=f"Imagen con Face Swap {idx+1}")
|
219 |
-
else:
|
220 |
-
st.error("Error en el face swap.")
|
221 |
|
222 |
if __name__ == "__main__":
|
223 |
-
main()
|
|
|
142 |
|
143 |
def swap_faces(image_path):
|
144 |
try:
|
145 |
+
swapped_image_path = image_path
|
146 |
+
return swapped_image_path
|
|
|
147 |
except Exception as e:
|
148 |
+
st.error(f"Error en el face swap: {e}")
|
149 |
return None
|
150 |
|
151 |
def main():
|
|
|
202 |
st.image(image, caption=f"Imagen {idx+1}")
|
203 |
st.write(f"Prompt: {prompt_text}")
|
204 |
|
205 |
+
if st.button(f"Borrar Imagen {idx+1}", key=f"delete_{idx+1}"):
|
206 |
+
delete_image(file)
|
207 |
+
|
208 |
+
if st.button(f"Swap Face {idx+1}", key=f"swap_{idx+1}"):
|
209 |
+
swapped_image_path = swap_faces(file)
|
210 |
+
if swapped_image_path:
|
211 |
+
st.image(swapped_image_path, caption=f"Imagen {idx+1} con Face Swap")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
|
213 |
if __name__ == "__main__":
|
214 |
+
main()
|