assile commited on
Commit
9f28bcd
·
verified ·
1 Parent(s): bddbfd2

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +24 -23
run.py CHANGED
@@ -1,28 +1,29 @@
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__":
27
- app = launch_interface()
28
- app.launch(server_name="0.0.0.0", server_port=7860)
 
1
  import gradio as gr
2
+ import cv2
3
+ import numpy as np
4
 
5
+ def simple_processing(source_img, target_img):
6
+ try:
7
+ # Conversion des images
8
+ source = np.array(source_img)
9
+ target = np.array(target_img)
 
 
10
 
11
+ # Traitement minimaliste (à remplacer par votre logique)
12
+ result = cv2.addWeighted(source, 0.5, target, 0.5, 0)
13
+ return result
14
+ except Exception as e:
15
+ print(f"Error: {str(e)}")
16
+ return None
17
+
18
+ with gr.Blocks() as demo:
19
+ gr.Markdown("## FaceSwap Minimal")
20
+ with gr.Row():
21
+ input1 = gr.Image(label="Source Image")
22
+ input2 = gr.Image(label="Target Image")
23
+ output = gr.Image(label="Result")
24
+
25
+ btn = gr.Button("Process Images")
26
+ btn.click(simple_processing, inputs=[input1, input2], outputs=output)
27
 
28
  if __name__ == "__main__":
29
+ demo.launch(server_name="0.0.0.0", server_port=7860)