This repository has been archived by the owner on Aug 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathcomfyflow_app.py
72 lines (59 loc) · 2.29 KB
/
comfyflow_app.py
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
import streamlit as st
import argparse
from loguru import logger
from streamlit_extras.badges import badge
from modules import get_workspace_model, get_comfy_client
def page_header():
st.set_page_config(page_title="ComfyFlowApp: Load a comfyui workflow as webapp in seconds.",
page_icon=":artist:", layout="wide")
# reduce top padding
st.markdown("""
<style>
.block-container {
padding-top: 1rem;
padding-bottom: 0rem;
# padding-left: 5rem;
# padding-right: 5rem;
}
</style>
""", unsafe_allow_html=True)
hide_streamlit_style = """
<style>
#MainMenu {visibility: hidden;}
footer {visibility: hidden;}
</style>
"""
st.markdown(hide_streamlit_style, unsafe_allow_html=True)
with st.sidebar:
st.sidebar.markdown("""
<style>
[data-testid='stSidebarNav'] > ul {
min-height: 70vh;
}
</style>
""", unsafe_allow_html=True)
st.image("public/images/logo.png", width=200)
st.sidebar.markdown("""
### ComfyFlowApp
Load a comfyui workflow as webapp in seconds.
""")
badge(type="github", name="xingren23/ComfyFlowApp", url="https://github.com/xingren23/ComfyFlowApp")
badge(type="twitter", name="xingren23", url="https://twitter.com/xingren23")
parser = argparse.ArgumentParser(description='Comfyflow manager')
parser.add_argument('--app', type=str, default='', help='comfyflow app id')
args = parser.parse_args()
page_header()
with st.container():
apps = get_workspace_model().get_all_apps()
app_id_map = { str(app.id): app for app in apps}
app_id = args.app
logger.info(f"load app app_id {app_id}")
if app_id not in app_id_map:
st.warning(f"App {app_id} hasn't existed")
else:
app = app_id_map[app_id]
app_data = app.app_conf
api_data = app.api_conf
from modules.comfyflow import Comfyflow
comfy_flow = Comfyflow(comfy_client=get_comfy_client(), api_data=api_data, app_data=app_data)
comfy_flow.create_ui(show_header=True)