File size: 1,248 Bytes
3ba3ce7
 
 
fc840c7
 
3ba3ce7
 
 
 
 
 
 
 
 
 
fc840c7
3ba3ce7
 
 
 
14502af
3ba3ce7
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import gradio as gr
from face_parsing import integration_with_meme

def replace_face(person_image, face_x, face_y, face_width, face_height, flip):
    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, flip=flip)
    return result_image

interface = gr.Interface(
    fn=replace_face,
    inputs=[
        gr.Image(type="pil", label="Upload Person Image"),
        gr.Slider(0, 500, 70, step=1, label="Face X Coordinate"),
        gr.Slider(0, 500, 40, step=1, label="Face Y Coordinate"),
        gr.Slider(10, 200, 100, step=1, label="Face Width"),
        gr.Slider(10, 200, 100, step=1, label="Face Height"),
        gr.Checkbox(label="Flip Person Image Horizontally"),
    ],
    outputs=gr.Image(type="pil", label="Result Image"),
    allow_flagging="never",
    title="Chill Guy Maker!",
    description="Upload your image, adjust the face coordinates, and become a chill guy. Check the project readme for more information: https://github.com/sartq333/chill-guy-maker/blob/main/README.md"
)

with interface:
    gr.Markdown(
        """
        ---
        **Created by [sartq333](https://github.com/sartq333)**
        """
    )

interface.launch()