File size: 2,667 Bytes
41978ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import gradio as gr
from core.settings import *

from .shared import txt2img_ui, img2img_ui, inpaint_ui, outpaint_ui, hires_fix_ui
from .tabs import newbie_ui

def build_ui(event_handler_function):
    ui_components = {}

    with gr.Blocks() as demo:
        gr.Markdown("# ImageGen - NewBie-Image")
        gr.Markdown(
            "This demo is a streamlined version of the [Comfy web UI](https://github.com/RioShiina47/comfy-webui)'s ImgGen functionality. "
            "Other versions are also available: "
            "[Z-Image](https://huggingface.co/spaces/RioShiina/ImageGen-Z-Image), "
            "[Qwen-Image](https://huggingface.co/spaces/RioShiina/ImageGen-Qwen-Image), "
            "[Illstrious](https://huggingface.co/spaces/RioShiina/ImageGen-Illstrious), "
            "[NoobAI](https://huggingface.co/spaces/RioShiina/ImageGen-NoobAI), "
            "[Pony](https://huggingface.co/spaces/RioShiina/ImageGen-Pony1), "
            "[SDXL](https://huggingface.co/spaces/RioShiina/ImageGen-SDXL), "
            "[SD1.5](https://huggingface.co/spaces/RioShiina/ImageGen-SD15)"
        )
        with gr.Tabs(elem_id="tabs_container") as tabs:
            with gr.TabItem("NewBie-Image", id=0):
                with gr.Tabs(elem_id="image_gen_tabs") as image_gen_tabs:
                    with gr.TabItem("Txt2Img", id=0):
                        ui_components.update(txt2img_ui.create_ui())
                    
                    with gr.TabItem("Img2Img", id=1):
                        ui_components.update(img2img_ui.create_ui())

                    with gr.TabItem("Inpaint", id=2):
                        ui_components.update(inpaint_ui.create_ui())

                    with gr.TabItem("Outpaint", id=3):
                        ui_components.update(outpaint_ui.create_ui())

                    with gr.TabItem("Hires. Fix", id=4):
                        ui_components.update(hires_fix_ui.create_ui())
                
                ui_components['image_gen_tabs'] = image_gen_tabs

            with gr.TabItem("NewBie XML Generator", id=1):
                ui_components.update(newbie_ui.create_ui())
            
            ui_components["tabs"] = tabs
        
        gr.Markdown("<div style='text-align: center; margin-top: 20px;'>Made by RioShiina with ❤️<br><a href='https://github.com/RioShiina47' target='_blank'>GitHub</a> | <a href='https://huggingface.co/RioShiina' target='_blank'>Hugging Face</a> | <a href='https://civitai.com/user/RioShiina' target='_blank'>Civitai</a></div>")
        
        event_handler_function(ui_components, demo)

    return demo