File size: 1,059 Bytes
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
import gradio as gr
from face_parsing import integration_with_meme

def replace_face(person_image, face_x, face_y, face_width, face_height):
    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)
    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"),
    ],
    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."
)

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

interface.launch()