Spaces:
Sleeping
Sleeping
Update run.py
Browse files
run.py
CHANGED
@@ -1,28 +1,29 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
|
|
3 |
|
4 |
-
def
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
target = gr.Image(label="Cible", type="filepath")
|
10 |
-
output = gr.Image(label="Résultat")
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
25 |
|
26 |
if __name__ == "__main__":
|
27 |
-
|
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)
|
|