mirror of
https://github.com/Sygil-Dev/sygil-webui.git
synced 2024-12-14 22:13:41 +03:00
Added barfi/baklavajs to the Tools menu and added a new post processing tab which is still a work in progress. (#1634)
# Description - Added a basic implementation of [Barfi](https://github.com/krish-adi/barfi) under the Tools menu which should allow us to create nodes for a node/flow based content generation and potentially allowing us to connect the UI with external apps like Houdini, Blender,etc. - Added basic post-processing tab which is still being worked on.
This commit is contained in:
commit
62f9706d6a
@ -321,7 +321,7 @@ gfpgan:
|
||||
strength: 100
|
||||
|
||||
textual_inversion:
|
||||
pretrained_model_name_or_path: "models/diffusers/stable-diffusion-v1-4"
|
||||
pretrained_model_name_or_path: "models/diffusers/stable-diffusion-v1-5"
|
||||
tokenizer_name: "models/clip-vit-large-patch14"
|
||||
|
||||
|
||||
|
@ -160,7 +160,7 @@ div.gallery:hover {
|
||||
/* Remove some empty spaces to make the UI more compact. */
|
||||
.css-18e3th9{
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
padding-right: 30px;
|
||||
position: unset !important; /* Fixes the layout/page going up when an expander or another item is expanded and then collapsed */
|
||||
}
|
||||
.css-k1vhr4{
|
||||
|
@ -31,6 +31,8 @@ streamlit-option-menu==0.3.2
|
||||
streamlit_nested_layout==0.1.1
|
||||
streamlit-server-state==0.14.2
|
||||
streamlit-tensorboard==0.0.2
|
||||
streamlit-elements==0.1.* # used for the draggable dashboard and new UI design (WIP)
|
||||
streamlit-ace==0.1.1 # used to replace the text area on the prompt and also for the code editor tool.
|
||||
hydralit==1.0.14
|
||||
hydralit_components==1.0.10
|
||||
stqdm==0.0.4
|
||||
|
97
scripts/barfi_baklavajs.py
Normal file
97
scripts/barfi_baklavajs.py
Normal file
@ -0,0 +1,97 @@
|
||||
# This file is part of sygil-webui (https://github.com/Sygil-Dev/sandbox-webui/).
|
||||
|
||||
# Copyright 2022 Sygil-Dev team.
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# base webui import and utils.
|
||||
#from sd_utils import *
|
||||
from sd_utils import *
|
||||
# streamlit imports
|
||||
|
||||
#streamlit components section
|
||||
|
||||
#other imports
|
||||
import os, time, requests
|
||||
import sys
|
||||
|
||||
from barfi import st_barfi, barfi_schemas, Block
|
||||
|
||||
# Temp imports
|
||||
|
||||
# end of imports
|
||||
#---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
def layout():
|
||||
#st.info("Under Construction. :construction_worker:")
|
||||
|
||||
#from barfi import st_barfi, Block
|
||||
|
||||
#add = Block(name='Addition')
|
||||
#sub = Block(name='Subtraction')
|
||||
#mul = Block(name='Multiplication')
|
||||
#div = Block(name='Division')
|
||||
|
||||
#barfi_result = st_barfi(base_blocks= [add, sub, mul, div])
|
||||
# or if you want to use a category to organise them in the frontend sub-menu
|
||||
#barfi_result = st_barfi(base_blocks= {'Op 1': [add, sub], 'Op 2': [mul, div]})
|
||||
|
||||
col1, col2, col3 = st.columns([1, 8, 1])
|
||||
|
||||
from barfi import st_barfi, barfi_schemas, Block
|
||||
|
||||
|
||||
with col2:
|
||||
feed = Block(name='Feed')
|
||||
feed.add_output()
|
||||
def feed_func(self):
|
||||
self.set_interface(name='Output 1', value=4)
|
||||
feed.add_compute(feed_func)
|
||||
|
||||
splitter = Block(name='Splitter')
|
||||
splitter.add_input()
|
||||
splitter.add_output()
|
||||
splitter.add_output()
|
||||
def splitter_func(self):
|
||||
in_1 = self.get_interface(name='Input 1')
|
||||
value = (in_1/2)
|
||||
self.set_interface(name='Output 1', value=value)
|
||||
self.set_interface(name='Output 2', value=value)
|
||||
splitter.add_compute(splitter_func)
|
||||
|
||||
mixer = Block(name='Mixer')
|
||||
mixer.add_input()
|
||||
mixer.add_input()
|
||||
mixer.add_output()
|
||||
def mixer_func(self):
|
||||
in_1 = self.get_interface(name='Input 1')
|
||||
in_2 = self.get_interface(name='Input 2')
|
||||
value = (in_1 + in_2)
|
||||
self.set_interface(name='Output 1', value=value)
|
||||
mixer.add_compute(mixer_func)
|
||||
|
||||
result = Block(name='Result')
|
||||
result.add_input()
|
||||
def result_func(self):
|
||||
in_1 = self.get_interface(name='Input 1')
|
||||
result.add_compute(result_func)
|
||||
|
||||
load_schema = st.selectbox('Select a saved schema:', barfi_schemas())
|
||||
|
||||
compute_engine = st.checkbox('Activate barfi compute engine', value=False)
|
||||
|
||||
barfi_result = st_barfi(base_blocks=[feed, result, mixer, splitter],
|
||||
compute_engine=compute_engine, load_schema=load_schema)
|
||||
|
||||
if barfi_result:
|
||||
st.write(barfi_result)
|
@ -367,9 +367,6 @@ def layout():
|
||||
col1, col2 = st.columns([1, 4], gap="large")
|
||||
|
||||
with col1:
|
||||
#url = st.text_area("Input Text","")
|
||||
#url = st.text_input("Input Text","", placeholder="A corgi wearing a top hat as an oil painting.")
|
||||
#st.subheader("Input Image")
|
||||
st.session_state["uploaded_image"] = st.file_uploader('Input Image', type=['png', 'jpg', 'jpeg', 'jfif', 'webp'], accept_multiple_files=True)
|
||||
|
||||
with st.expander("CLIP models", expanded=True):
|
||||
|
34
scripts/post_processing.py
Normal file
34
scripts/post_processing.py
Normal file
@ -0,0 +1,34 @@
|
||||
# This file is part of sygil-webui (https://github.com/Sygil-Dev/sandbox-webui/).
|
||||
|
||||
# Copyright 2022 Sygil-Dev team.
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# base webui import and utils.
|
||||
#from sd_utils import *
|
||||
from sd_utils import *
|
||||
# streamlit imports
|
||||
|
||||
#streamlit components section
|
||||
|
||||
#other imports
|
||||
import os, time, requests
|
||||
import sys
|
||||
|
||||
# Temp imports
|
||||
|
||||
# end of imports
|
||||
#---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
def layout():
|
||||
st.info("Under Construction. :construction_worker:")
|
@ -130,7 +130,7 @@ def layout():
|
||||
{'id': 'Model Manager', 'label': 'Model Manager', 'icon': 'bi bi-cloud-arrow-down-fill'},
|
||||
{'id': 'Tools','label':"Tools", 'icon': "bi bi-tools", 'submenu':[
|
||||
{'id': 'API Server', 'label': 'API Server', 'icon': 'bi bi-server'},
|
||||
#{'id': 'Barfi/BaklavaJS', 'label': 'Barfi/BaklavaJS', 'icon': 'bi bi-diagram-3-fill'},
|
||||
{'id': 'Barfi/BaklavaJS', 'label': 'Barfi/BaklavaJS', 'icon': 'bi bi-diagram-3-fill'},
|
||||
#{'id': 'API Server', 'label': 'API Server', 'icon': 'bi bi-server'},
|
||||
]},
|
||||
{'id': 'Settings', 'label': 'Settings', 'icon': 'bi bi-gear-fill'},
|
||||
@ -190,10 +190,10 @@ def layout():
|
||||
except NameError:
|
||||
st.experimental_rerun()
|
||||
|
||||
txt2img_tab, img2img_tab, txt2vid_tab, img2txt_tab, concept_library_tab = st.tabs(["Text-to-Image", "Image-to-Image",
|
||||
#"Inpainting",
|
||||
"Text-to-Video", "Image-To-Text",
|
||||
"Concept Library"])
|
||||
txt2img_tab, img2img_tab, txt2vid_tab, img2txt_tab, post_processing_tab, concept_library_tab = st.tabs(["Text-to-Image", "Image-to-Image",
|
||||
#"Inpainting",
|
||||
"Text-to-Video", "Image-To-Text",
|
||||
"Post-Processing","Concept Library"])
|
||||
#with home_tab:
|
||||
#from home import layout
|
||||
#layout()
|
||||
@ -218,6 +218,10 @@ def layout():
|
||||
from img2txt import layout
|
||||
layout()
|
||||
|
||||
with post_processing_tab:
|
||||
from post_processing import layout
|
||||
layout()
|
||||
|
||||
with concept_library_tab:
|
||||
from sd_concept_library import layout
|
||||
layout()
|
||||
@ -243,10 +247,10 @@ def layout():
|
||||
from APIServer import layout
|
||||
layout()
|
||||
|
||||
#elif menu_id == 'Barfi/BaklavaJS':
|
||||
#set_page_title("Barfi/BaklavaJS - Stable Diffusion Playground")
|
||||
#from barfi_baklavajs import layout
|
||||
#layout()
|
||||
elif menu_id == 'Barfi/BaklavaJS':
|
||||
set_page_title("Barfi/BaklavaJS - Stable Diffusion Playground")
|
||||
from barfi_baklavajs import layout
|
||||
layout()
|
||||
|
||||
elif menu_id == 'Settings':
|
||||
set_page_title("Settings - Stable Diffusion Playground")
|
||||
|
Loading…
Reference in New Issue
Block a user