File size: 636 Bytes
44438f1
2d4b28c
86cb043
 
a1461d7
2d4b28c
 
 
43758bf
2d4b28c
 
43758bf
2d4b28c
 
 
43758bf
2d4b28c
 
 
44438f1
2d4b28c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from transformers import pipeline
import gradio as gr


generator = pipeline("image-to-image", model="timbrooks/instruct-pix2pix")
def generate_face_variations(image):
    variations = generator(image, num_images=4, guidance_scale=7.5)
    return variations

with gr.Blocks() as demo:
    gr.Markdown("# Face Position Variation Generator")
    
    with gr.Row():
        input_image = gr.Image(type="pil")
        output_gallery = gr.Gallery().style(grid=2, height="auto")
    
    generate_btn = gr.Button("Generate")
    
    generate_btn.click(fn=generate_face_variations, inputs=input_image, outputs=output_gallery)

demo.launch()