diff --git a/frontend/css/streamlit.main.css b/frontend/css/streamlit.main.css
index 37f8000..a11d21d 100644
--- a/frontend/css/streamlit.main.css
+++ b/frontend/css/streamlit.main.css
@@ -92,4 +92,20 @@ button[kind="header"] {
/***********************************************************
* Additional CSS for other elements
-************************************************************/
\ No newline at end of file
+************************************************************/
+button[data-baseweb="tab"] {
+ font-size: 20px;
+}
+
+@media (min-width: 1200px){
+h1 {
+ font-size: 1.75rem;
+}
+}
+#tabs-1-tabpanel-0 > div:nth-child(1) > div > div.stTabs.css-0.exp6ofz0 {
+ width: 50rem;
+ align-self: center;
+}
+div.gallery:hover {
+ border: 1px solid #777;
+}
\ No newline at end of file
diff --git a/scripts/home.py b/scripts/home.py
index 7f3ce7e..2103dd8 100644
--- a/scripts/home.py
+++ b/scripts/home.py
@@ -1,5 +1,18 @@
-from webui_streamlit import st, defaults
+# base webui import and utils.
+from webui_streamlit import st
from sd_utils import *
+
+# streamlit imports
+
+
+#other imports
+
+# Temp imports
+
+
+# end of imports
+#---------------------------------------------------------------------------------------------------------------
+
import os
from PIL import Image
@@ -30,15 +43,17 @@ def getLatestGeneratedImagesFromPath():
files.append(os.path.join(r, file))
#sort the files by date
files.sort(key=os.path.getmtime)
+
#reverse the list so the latest images are first
for f in files:
img = Image.open(f)
files[files.index(f)] = img
+
#get the latest 10 files
#get all the files with the .png or .jpg extension
#sort files by date
#get the latest 10 files
- latestFiles = files[-10:]
+ latestFiles = files
#reverse the list
latestFiles.reverse()
return latestFiles
@@ -98,41 +113,109 @@ def layout():
# create a tab for the gallery
#st.markdown("
"""
- mkdwn_array = []
- for i in images:
- try:
- seed = info[images.index(i)]
- except:
- seed = ' '
- image_io = BytesIO()
- i.save(image_io, 'PNG')
- width, height = i.size
- #get random number for the id
- image_id = "%s" % (str(images.index(i)))
- (data, mimetype) = STImage._normalize_to_bytes(image_io.getvalue(), width, 'auto')
- this_file = in_memory_file_manager.add(data, mimetype, image_id)
- img_str = this_file.url
- #img_str = 'data:image/png;base64,' + b64encode(image_io.getvalue()).decode('ascii')
- #get image size
-
- #make sure the image is not bigger then 150px but keep the aspect ratio
- if width > 150:
- height = int(height * (150/width))
- width = 150
- if height > 150:
- width = int(width * (150/height))
- height = 150
+ mkdwn_array = []
+ for i in images:
+ try:
+ seed = info[images.index(i)]
+ except:
+ seed = ' '
+ image_io = BytesIO()
+ i.save(image_io, 'PNG')
+ width, height = i.size
+ #get random number for the id
+ image_id = "%s" % (str(images.index(i)))
+ (data, mimetype) = STImage._normalize_to_bytes(image_io.getvalue(), width, 'auto')
+ this_file = in_memory_file_manager.add(data, mimetype, image_id)
+ img_str = this_file.url
+ #img_str = 'data:image/png;base64,' + b64encode(image_io.getvalue()).decode('ascii')
+ #get image size
- #mkdwn = f"""
"""
- mkdwn = f'''
-
-
-
-
{seed}
+ #make sure the image is not bigger then 150px but keep the aspect ratio
+ if width > 150:
+ height = int(height * (150/width))
+ width = 150
+ if height > 150:
+ width = int(width * (150/height))
+ height = 150
+
+ #mkdwn = f"""
"""
+ mkdwn = f'''
'''
- mkdwn_array.append(mkdwn)
- html3 += "".join(mkdwn_array)
- html3 += '
'
- return html3
\ No newline at end of file
+ mkdwn_array.append(mkdwn)
+ html3 += "".join(mkdwn_array)
+ html3 += '
'
+ return html3
\ No newline at end of file
diff --git a/scripts/txt2vid.py b/scripts/txt2vid.py
index 88f3201..0df27fc 100644
--- a/scripts/txt2vid.py
+++ b/scripts/txt2vid.py
@@ -481,7 +481,7 @@ def txt2vid(
Took { round(time_diff, 2) }s total ({ round(time_diff/(max_frames),2) }s per image)
Peak memory usage: { -(mem_max_used // -1_048_576) } MiB / { -(mem_total // -1_048_576) } MiB / { round(mem_max_used/mem_total*100, 3) }%'''
- return im, seeds, info, stats
+ return video_path, seeds, info, stats
#on import run init
def createHTMLGallery(images,info):
@@ -679,7 +679,7 @@ def layout():
#load_models(False, False, False, st.session_state["RealESRGAN_model"], CustomModel_available=st.session_state["CustomModel_available"], custom_model=custom_model)
# run video generation
- image, seed, info, stats = txt2vid(prompts=prompt, gpu=st.session_state["defaults"].general.gpu,
+ video, seed, info, stats = txt2vid(prompts=prompt, gpu=st.session_state["defaults"].general.gpu,
num_steps=st.session_state.sampling_steps, max_frames=int(st.session_state.max_frames),
num_inference_steps=st.session_state.num_inference_steps,
cfg_scale=cfg_scale,do_loop=st.session_state["do_loop"],
@@ -690,12 +690,49 @@ def layout():
#message.success('Done!', icon="✅")
message.success('Render Complete: ' + info + '; Stats: ' + stats, icon="✅")
+
+ history_tab,col1,col2,col3,PlaceHolder,col1_cont,col2_cont,col3_cont = st.session_state['historyTab']
+
+ #if 'latestVideos' in st.session_state:
+ #for i in video:
+ ##push the new image to the list of latest images and remove the oldest one
+ ##remove the last index from the list\
+ #st.session_state['latestVideos'].pop()
+ ##add the new image to the start of the list
+ #st.session_state['latestVideos'].insert(0, i)
+ #PlaceHolder.empty()
+
+ #with PlaceHolder.container():
+ #col1, col2, col3 = st.columns(3)
+ #col1_cont = st.container()
+ #col2_cont = st.container()
+ #col3_cont = st.container()
+
+ #with col1_cont:
+ #with col1:
+ #st.image(st.session_state['latestVideos'][0])
+ #st.image(st.session_state['latestVideos'][3])
+ #st.image(st.session_state['latestVideos'][6])
+ #with col2_cont:
+ #with col2:
+ #st.image(st.session_state['latestVideos'][1])
+ #st.image(st.session_state['latestVideos'][4])
+ #st.image(st.session_state['latestVideos'][7])
+ #with col3_cont:
+ #with col3:
+ #st.image(st.session_state['latestVideos'][2])
+ #st.image(st.session_state['latestVideos'][5])
+ #st.image(st.session_state['latestVideos'][8])
+ #historyGallery = st.empty()
+
+ ## check if output_images length is the same as seeds length
+ #with gallery_tab:
+ #st.markdown(createHTMLGallery(video,seed), unsafe_allow_html=True)
+
+
+ #st.session_state['historyTab'] = [history_tab,col1,col2,col3,PlaceHolder,col1_cont,col2_cont,col3_cont]
#except (StopException, KeyError):
#print(f"Received Streamlit StopException")
- # this will render all the images at the end of the generation but its better if its moved to a second tab inside col2 and shown as a gallery.
- # use the current col2 first tab to show the preview_img and update it as its generated.
- #preview_image.image(output_images)
-
diff --git a/scripts/webui_streamlit.py b/scripts/webui_streamlit.py
index 1f8141f..5288545 100644
--- a/scripts/webui_streamlit.py
+++ b/scripts/webui_streamlit.py
@@ -105,8 +105,12 @@ def layout():
iconName=['dashboard','model_training' ,'cloud_download', 'settings'], default_choice=0)
if tabs =='Stable Diffusion':
- txt2img_tab, img2img_tab, txt2vid_tab, postprocessing_tab = st.tabs(["Text-to-Image Unified", "Image-to-Image Unified",
- "Text-to-Video","Post-Processing"])
+ home_tab, txt2img_tab, img2img_tab, txt2vid_tab, postprocessing_tab = st.tabs(["Home","Text-to-Image Unified", "Image-to-Image Unified",
+ "Text-to-Video","Post-Processing"])
+ with home_tab:
+ from home import layout
+ layout()
+
with txt2img_tab:
from txt2img import layout
layout()