Spaces:
Sleeping
Sleeping
import gradio as gr | |
from gen_tab import create_gen_tab | |
from train_tab import create_train_tab | |
from virtualtryon_tab import create_virtualtryon_tab | |
from faceswap_tab import create_faceswap_tab | |
from ipadapter_tab import create_ipadaptor_tab | |
from dotenv import load_dotenv, find_dotenv | |
import os | |
gallery_list=[] | |
def update_gallery(img): | |
gallery_list.append(img) | |
return gallery_list | |
_ = load_dotenv(find_dotenv()) | |
with gr.Blocks(theme=gr.themes.Soft( | |
radius_size=gr.themes.sizes.radius_none, | |
primary_hue=gr.themes.colors.emerald, | |
secondary_hue=gr.themes.colors.green | |
)) as demo: | |
with gr.Tabs() as tabs: | |
gen_out,move_to_vto,move_to_fs,move_to_ip = create_gen_tab() | |
input_vto,output_vto=create_virtualtryon_tab() | |
input_fs,output_fs=create_faceswap_tab() | |
input_ip,output_ip=create_ipadaptor_tab() | |
create_train_tab() | |
#Buttons | |
move_to_vto.click(lambda x:x, inputs=gen_out,outputs=input_vto) | |
move_to_fs.click(lambda x:x, inputs=gen_out,outputs=input_fs) | |
move_to_ip.click(lambda x:x, inputs=gen_out,outputs=input_ip) | |
#Gallery | |
image_gallery = gr.Gallery(label="Generated Images Gallery", type="filepath") | |
#Gallery updates | |
gen_out.change(update_gallery,inputs=gen_out,outputs=image_gallery) | |
output_vto.change(update_gallery,inputs=output_vto,outputs=image_gallery) | |
output_fs.change(update_gallery,inputs=output_fs,outputs=image_gallery) | |
output_ip.change(update_gallery,inputs=output_ip,outputs=image_gallery) | |
demo.launch(share=True,debug=True) #,auth=[("username", "password"),(os.getenv("APP_USER"),os.getenv("APP_PW"))]) | |