Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from face_parsing import integration_with_meme
|
| 3 |
+
|
| 4 |
+
def replace_face(person_image, face_x, face_y, face_width, face_height):
|
| 5 |
+
result_image = integration_with_meme(input_img_path=person_image, face_x=face_x, face_y=face_y, face_width=face_width, face_height=face_height)
|
| 6 |
+
return result_image
|
| 7 |
+
|
| 8 |
+
interface = gr.Interface(
|
| 9 |
+
fn=replace_face,
|
| 10 |
+
inputs=[
|
| 11 |
+
gr.Image(type="pil", label="Upload Person Image"),
|
| 12 |
+
gr.Slider(0, 500, 70, step=1, label="Face X Coordinate"),
|
| 13 |
+
gr.Slider(0, 500, 40, step=1, label="Face Y Coordinate"),
|
| 14 |
+
gr.Slider(10, 200, 100, step=1, label="Face Width"),
|
| 15 |
+
gr.Slider(10, 200, 100, step=1, label="Face Height"),
|
| 16 |
+
],
|
| 17 |
+
outputs=gr.Image(type="pil", label="Result Image"),
|
| 18 |
+
allow_flagging="never",
|
| 19 |
+
title="Chill Guy Maker!",
|
| 20 |
+
description="Upload your image, adjust the face coordinates, and become a chill guy."
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
with interface:
|
| 24 |
+
gr.Markdown(
|
| 25 |
+
"""
|
| 26 |
+
---
|
| 27 |
+
**Created by [sartq333](https://github.com/sartq333)**
|
| 28 |
+
"""
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
interface.launch()
|