Spaces:
				
			
			
	
			
			
					
		Running
		
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
	File size: 2,203 Bytes
			
			| 7db4b63 7df68a5 7db4b63 09a89dc 46438b0 09a89dc 46438b0 09a89dc 46438b0 09a89dc 46438b0 09a89dc 46438b0 09a89dc 46438b0 09a89dc 46438b0 09a89dc 46438b0 09a89dc 46438b0 09a89dc 46438b0 09a89dc 46438b0 09a89dc cdc39b5 | 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | #!/usr/bin/env python
from __future__ import annotations
import gradio as gr
from model import Model
DESCRIPTION = "# [StyleGAN-Human](https://github.com/stylegan-human/StyleGAN-Human)"
model = Model()
with gr.Blocks(css="style.css") as demo:
    gr.Markdown(DESCRIPTION)
    with gr.Row():
        with gr.Column():
            with gr.Row():
                seed1 = gr.Number(label="Seed 1", value=6876)
                psi1 = gr.Slider(label="Truncation psi 1", minimum=0, maximum=2, step=0.05, value=0.7)
            with gr.Row():
                generate_button1 = gr.Button("Generate")
            with gr.Row():
                generated_image1 = gr.Image(label="Generated Image 1", type="numpy", height=600)
        with gr.Column():
            with gr.Row():
                seed2 = gr.Number(label="Seed 2", value=6886)
                psi2 = gr.Slider(label="Truncation psi 2", minimum=0, maximum=2, step=0.05, value=0.7)
            with gr.Row():
                generate_button2 = gr.Button("Generate")
            with gr.Row():
                generated_image2 = gr.Image(label="Generated Image 2", type="numpy", height=600)
    with gr.Row():
        with gr.Column():
            with gr.Row():
                num_frames = gr.Slider(label="Number of Intermediate Frames", minimum=0, maximum=41, step=1, value=7)
            with gr.Row():
                interpolate_button = gr.Button("Interpolate")
            with gr.Row():
                interpolated_images = gr.Gallery(label="Output Images", object_fit="scale-down")
    generate_button1.click(
        model.generate_single_image,
        inputs=[
            seed1,
            psi1,
        ],
        outputs=generated_image1,
    )
    generate_button2.click(
        model.generate_single_image,
        inputs=[
            seed2,
            psi2,
        ],
        outputs=generated_image2,
    )
    interpolate_button.click(
        model.generate_interpolated_images,
        inputs=[
            seed1,
            psi1,
            seed2,
            psi2,
            num_frames,
        ],
        outputs=interpolated_images,
    )
if __name__ == "__main__":
    demo.queue(max_size=10).launch()
 | 
