File size: 1,026 Bytes
6bcacf9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e34a7f6
6bcacf9
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from constants import APP_VERSION
from frontend.webui.text_to_image_ui import get_text_to_image_ui
from paths import FastStableDiffusionPaths
from app_settings import AppSettings


def _get_footer_message() -> str:
    version = f"<center><p> v{APP_VERSION} "
    footer_msg = version + (
        '  © 2023 <a href="https://github.com/rupeshs">'
        " Rupesh Sreeraman</a></p></center>"
    )
    return footer_msg


def get_web_ui(app_settings: AppSettings) -> gr.Blocks:
    with gr.Blocks(
        css=FastStableDiffusionPaths.get_css_path(),
        title="FastSD CPU",
    ) as fastsd_web_ui:
        gr.HTML("<center><H1>FastSD CPU demo (OpenVINO)</H1></center>")
        with gr.Tabs():
            with gr.TabItem("Text to Image"):
                get_text_to_image_ui(app_settings)
        gr.HTML(_get_footer_message())

    return fastsd_web_ui


def start_webui(
    app_settings: AppSettings,
    share: bool = False,
):
    webui = get_web_ui(app_settings)
    webui.launch(share=share)