Spaces:
Running
Running
Update run.py
Browse files
run.py
CHANGED
@@ -1,34 +1,26 @@
|
|
1 |
import gradio as gr
|
2 |
-
from
|
3 |
|
4 |
def launch_interface():
|
5 |
-
|
6 |
-
|
7 |
-
gr.Markdown("## 🔄 Face Swap avec Roop")
|
8 |
-
|
9 |
with gr.Row():
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
btn = gr.Button("Exécuter
|
15 |
-
|
16 |
-
def
|
17 |
try:
|
18 |
-
# Appel à la logique roop (exemple simplifié)
|
19 |
output_path = "result.jpg"
|
20 |
-
|
21 |
return output_path
|
22 |
except Exception as e:
|
23 |
-
print(f"
|
24 |
return None
|
25 |
-
|
26 |
-
btn.click(
|
27 |
-
fn=swap_faces,
|
28 |
-
inputs=[src_img, tgt_img],
|
29 |
-
outputs=result_img
|
30 |
-
)
|
31 |
-
|
32 |
return app
|
33 |
|
34 |
if __name__ == "__main__":
|
|
|
1 |
import gradio as gr
|
2 |
+
from roop_unleashed import Core # Changement d'import
|
3 |
|
4 |
def launch_interface():
|
5 |
+
with gr.Blocks() as app:
|
6 |
+
gr.Markdown("## Face Swap")
|
|
|
|
|
7 |
with gr.Row():
|
8 |
+
src = gr.Image(label="Source", type="filepath")
|
9 |
+
target = gr.Image(label="Cible", type="filepath")
|
10 |
+
output = gr.Image(label="Résultat")
|
11 |
+
|
12 |
+
btn = gr.Button("Exécuter")
|
13 |
+
|
14 |
+
def process(src_path, tgt_path):
|
15 |
try:
|
|
|
16 |
output_path = "result.jpg"
|
17 |
+
Core().enhance_face(src_path, tgt_path, output_path) # Adaptez à l'API réelle
|
18 |
return output_path
|
19 |
except Exception as e:
|
20 |
+
print(f"Erreur : {e}")
|
21 |
return None
|
22 |
+
|
23 |
+
btn.click(process, inputs=[src, target], outputs=output)
|
|
|
|
|
|
|
|
|
|
|
24 |
return app
|
25 |
|
26 |
if __name__ == "__main__":
|