-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
85 lines (76 loc) · 2 KB
/
main.py
File metadata and controls
85 lines (76 loc) · 2 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env python
#
# Stable Diffusion Web App
# Streamlit version
#
import os
from datetime import datetime
import json
try:
import streamlit as st
from dotenv import dotenv_values
except Exception as e:
print(f"Caught fatal exception: {e}")
# local imports
from libs.shared.settings import Properties
# load environment
config_env: dict = dotenv_values(".env")
# load app settings
config_filename: str = config_env.get("CONFIG_FILE", "parameters.yaml")
appSettings = Properties(config_file=config_filename)
# MAIN
if __name__ == "__main__":
# load logo
st.logo("assets/redhat.png")
# define app pages
sd15_page = st.Page(
"pages/sd15_page.py",
title="Stable Diffusion 1.5",
icon=":material/chat:"
)
sd15_inpaint_page = st.Page(
"pages/sd15_inpaint_page.py",
title="SD15 Inpainting",
icon=":material/edit:"
)
sdxl_page = st.Page(
"pages/sdxl_page.py",
title="Stable Diffusion XL",
icon=":material/chat:"
)
sdxl_inpaint_page = st.Page(
"pages/sdxl_inpaint_page.py",
title="SDXL Inpainting",
icon=":material/edit:"
)
sd15_checkpoint_tools_page = st.Page(
"pages/sd15_tools_page.py",
title="SD15 Checkpoint Tools",
icon=":material/settings:",
)
sdxl_checkpoint_tools_page = st.Page(
"pages/sdxl_tools_page.py",
title="SDXL Checkpoint Tools",
icon=":material/settings:",
)
enabled_sections = {
"Txt2Img": [
sd15_page,
sdxl_page,
],
"Inpainting": [
sd15_inpaint_page,
sdxl_inpaint_page,
],
"Model Merging": [
sd15_checkpoint_tools_page,
sdxl_checkpoint_tools_page,
],
}
# setup application main page
pg = st.navigation(enabled_sections)
st.set_page_config(
page_title="Stable Diffusion WebApp", layout="wide", page_icon=":material/edit:"
)
# run app
pg.run()