Skip to content

Commit

Permalink
Small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
peteromallet committed Dec 23, 2023
1 parent b00f2e9 commit 23f1b03
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 47 deletions.
68 changes: 38 additions & 30 deletions ui_components/components/frame_styling_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,46 @@

def frame_styling_page(shot_uuid: str, h2,data_repo,shot,timing_list, project_settings):

if len(timing_list) == 0:
with h2:
frame_selector_widget(show=['shot_selector','frame_selector'])

st.markdown("#### There are no frames present in this shot yet.")




else:
with st.sidebar:
with h2:

with st.sidebar:
with h2:
frame_selector_widget(show=['shot_selector','frame_selector'])

st.session_state['styling_view'] = st_memory.menu('',\
["Generate", "Crop/Move", "Inpainting","Scribbling"], \
icons=['magic', 'crop', "paint-bucket", 'pencil'], \
menu_icon="cast", default_index=st.session_state.get('styling_view_index', 0), \
key="styling_view_selector", orientation="horizontal", \
styles={"nav-link": {"font-size": "15px", "margin": "0px", "--hover-color": "#eee"}, "nav-link-selected": {"background-color": "orange"}})

frame_selector_widget(show=['shot_selector','frame_selector'])

st.session_state['styling_view'] = st_memory.menu('',\
["Generate", "Crop/Move", "Inpainting","Scribbling"], \
icons=['magic', 'crop', "paint-bucket", 'pencil'], \
menu_icon="cast", default_index=st.session_state.get('styling_view_index', 0), \
key="styling_view_selector", orientation="horizontal", \
styles={"nav-link": {"font-size": "15px", "margin": "0px", "--hover-color": "#eee"}, "nav-link-selected": {"background-color": "orange"}})
st.markdown(f"#### :red[{st.session_state['main_view_type']}] > :green[{st.session_state['frame_styling_view_type']}] > :orange[{st.session_state['styling_view']}] > :blue[{shot.name} - #{st.session_state['current_frame_index']}]")

st.markdown(f"#### :red[{st.session_state['main_view_type']}] > :green[{st.session_state['frame_styling_view_type']}] > :orange[{st.session_state['styling_view']}] > :blue[{shot.name} - #{st.session_state['current_frame_index']}]")

if st.session_state['styling_view'] == "Generate":
variant_comparison_grid(st.session_state['current_frame_uuid'], stage=CreativeProcessType.STYLING.value)
with st.expander("🛠️ Generate Variants + Prompt Settings", expanded=True):
generate_images_element(position='individual', project_uuid=shot.project.uuid, timing_uuid=st.session_state['current_frame_uuid'])

elif st.session_state['styling_view'] == "Crop/Move":
with st.expander("🤏 Crop, Move & Rotate", expanded=True):
cropping_selector_element(shot_uuid)


if st.session_state['styling_view'] == "Generate":
variant_comparison_grid(st.session_state['current_frame_uuid'], stage=CreativeProcessType.STYLING.value)
with st.expander("🛠️ Generate Variants + Prompt Settings", expanded=True):
generate_images_element(position='individual', project_uuid=shot.project.uuid, timing_uuid=st.session_state['current_frame_uuid'])

elif st.session_state['styling_view'] == "Crop/Move":
with st.expander("🤏 Crop, Move & Rotate", expanded=True):
cropping_selector_element(shot_uuid)

elif st.session_state['styling_view'] == "Inpainting":
with st.expander("🌌 Inpainting", expanded=True):
inpainting_element(st.session_state['current_frame_uuid'])

elif st.session_state['styling_view'] == "Scribbling":
with st.expander("📝 Draw On Image", expanded=True):
drawing_element(timing_list,project_settings, shot_uuid)


elif st.session_state['styling_view'] == "Inpainting":
with st.expander("🌌 Inpainting", expanded=True):
inpainting_element(st.session_state['current_frame_uuid'])

elif st.session_state['styling_view'] == "Scribbling":
with st.expander("📝 Draw On Image", expanded=True):
drawing_element(timing_list,project_settings, shot_uuid)


10 changes: 10 additions & 0 deletions ui_components/components/timeline_view_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import streamlit as st
from ui_components.constants import CreativeProcessType
from ui_components.widgets.timeline_view import timeline_view
from ui_components.components.explorer_page import gallery_image_view
from streamlit_option_menu import option_menu
from utils import st_memory

def timeline_view_page(shot_uuid: str, h2,data_repo,shot,timing_list, project_settings):
with st.sidebar:
Expand All @@ -12,6 +14,14 @@ def timeline_view_page(shot_uuid: str, h2,data_repo,shot,timing_list, project_se
if "view" not in st.session_state:
st.session_state["view"] = views[0]
st.session_state["manual_select"] = None

with st.expander("📋 Explorer Shortlist",expanded=True):

if st_memory.toggle("Open", value=True, key="explorer_shortlist_toggle"):
project_setting = data_repo.get_project_setting(shot.project.uuid)
page_number = st.radio("Select page:", options=range(1, project_setting.total_shortlist_gallery_pages + 1), horizontal=True)
gallery_image_view(shot.project.uuid, page_number=page_number, num_items_per_page=10, open_detailed_view_for_all=False, shortlist=True, num_columns=2,view="sidebar")

with h2:
st.session_state['view'] = option_menu(None, views, icons=['palette', 'camera-reels', "hourglass", 'stopwatch'], menu_icon="cast", orientation="vertical", key="secti2on_selector", styles={
"nav-link": {"font-size": "15px", "margin": "0px", "--hover-color": "#eee"}, "nav-link-selected": {"background-color": "orange"}}, manual_select=st.session_state["manual_select"])
Expand Down
36 changes: 19 additions & 17 deletions ui_components/widgets/variant_comparison_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,6 @@ def variant_inference_detail_element(variant, stage, shot_uuid, timing_list="",
data_repo = DataRepo()
shot = data_repo.get_shot_from_uuid(shot_uuid)

st.markdown(f"Details:")
inf_data = fetch_inference_data(variant)
if 'image_prompt_list' in inf_data:
del inf_data['image_prompt_list']
del inf_data['image_list']
del inf_data['output_format']

st.write(inf_data)

if stage != CreativeProcessType.MOTION.value:
h1, h2 = st.columns([1, 1])
with h1:
st.markdown(f"Add to shortlist:")
add_variant_to_shortlist_element(variant, shot.project.uuid)
with h2:
add_variant_to_shot_element(variant, shot.project.uuid)

if stage == CreativeProcessType.MOTION.value:
if st.button("Load up settings from this variant", key=f"{tag}_{variant.name}", help="This will enter the settings from this variant into the inputs below - you can also use them on other shots", use_container_width=True):
print("Loading settings")
Expand All @@ -147,6 +130,25 @@ def variant_inference_detail_element(variant, stage, shot_uuid, timing_list="",
time.sleep(0.3)
st.rerun()

st.markdown(f"Details:")
inf_data = fetch_inference_data(variant)
if 'image_prompt_list' in inf_data:
del inf_data['image_prompt_list']
del inf_data['image_list']
del inf_data['output_format']

st.write(inf_data)

if stage != CreativeProcessType.MOTION.value:
h1, h2 = st.columns([1, 1])
with h1:
st.markdown(f"Add to shortlist:")
add_variant_to_shortlist_element(variant, shot.project.uuid)
with h2:
add_variant_to_shot_element(variant, shot.project.uuid)




def prepare_values(inf_data, timing_list):
settings = inf_data # Map interpolation_type to indices
Expand Down

0 comments on commit 23f1b03

Please sign in to comment.