Skip to content
This repository was archived by the owner on Dec 29, 2024. It is now read-only.

Commit 22abdb3

Browse files
authored
Merge pull request #193 from banodoco/staging
Staging
2 parents 2347517 + 25a0f86 commit 22abdb3

File tree

12 files changed

+170
-83
lines changed

12 files changed

+170
-83
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ images.zip
3333
depth.png
3434
masked_image.png
3535
concatenated.mp4
36-
temp.png
36+
temp.png
37+
scripts/app_checkpoint.json

app.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from shared.constants import HOSTED_BACKGROUND_RUNNER_MODE, OFFLINE_MODE, SERVER, ServerType
88
import sentry_sdk
99
from shared.logging.logging import AppLogger
10-
from utils.app_update_utils import check_for_updates
10+
from utils.app_update_utils import apply_updates, check_and_pull_changes, load_save_checkpoint
1111
from utils.common_utils import is_process_active
1212

1313
from utils.constants import AUTH_TOKEN, RUNNER_PROCESS_NAME, RUNNER_PROCESS_PORT
@@ -91,7 +91,10 @@ def main():
9191
# if it's the first time,
9292
if "first_load" not in st.session_state:
9393
if not is_process_active(RUNNER_PROCESS_NAME, RUNNER_PROCESS_PORT):
94-
check_for_updates() # enabling auto updates only for local version
94+
if not load_save_checkpoint():
95+
check_and_pull_changes() # enabling auto updates only for local version
96+
else:
97+
apply_updates()
9598
st.session_state["first_load"] = True
9699
start_runner()
97100
project_init()

django_settings.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
from pathlib import Path
33
import sys
4+
from django.db.backends.signals import connection_created
45

56
sys.path.append("../")
67

@@ -19,13 +20,19 @@
1920

2021
BASE_DIR = Path(__file__).resolve().parent.parent
2122

23+
def set_sqlite_timeout(sender, connection, **kwargs):
24+
if connection.vendor == 'sqlite':
25+
cursor = connection.cursor()
26+
cursor.execute('PRAGMA busy_timeout = 30000;') # 30 seconds
27+
2228
if HOSTED_BACKGROUND_RUNNER_MODE in [False, "False"]:
2329
DATABASES = {
2430
"default": {
2531
"ENGINE": "django.db.backends.sqlite3", # sqlite by default works with serializable isolation level
2632
"NAME": DB_LOCATION,
2733
}
2834
}
35+
connection_created.connect(set_sqlite_timeout)
2936
else:
3037
import boto3
3138

readme.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,8 @@ cd Dough
154154
---
155155

156156
### Using personal ComfyUI instance
157-
You can provide the path to your ComfyUI instance and Dough will use the models present there. Add the following at the bottom of the ".env" file
158-
```bash
159-
COMFY_MODELS_BASE_PATH="full_path_to_your_ComfyUI"
160-
```
161-
for e.g. in the case of Linux users this may look something like this
162-
163-
```bash
164-
COMFY_MODELS_BASE_PATH="/home/ubuntu/my_apps/ComfyUI/"
165-
```
157+
You can provide the path to your ComfyUI instance in the "App Settings" section of Dough
166158

167-
It will also download the new models in your personal ComfyUI instance. Please note that Dough
168-
will maintain it's own copy of the nodes and packages to not cause any issues with the packages that might already be installed on your personal ComfyUI.
169159

170160
If you're having any issues, please share them in our [Discord](https://discord.com/invite/8Wx9dFu5tP).
171161

scripts/app_version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.9.8
1+
0.9.8

ui_components/components/app_settings_page.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,26 @@ def app_settings_page():
101101
def custom_comfy_input_component():
102102
custom_comfy_key = "COMFY_MODELS_BASE_PATH"
103103
custom_comfy_path = load_from_env(custom_comfy_key)
104+
104105
if not custom_comfy_path:
105106
st.info(
106107
"""
107-
Please enter your custom ComfyUI path below. Dough will use the models present in your personal ComfyUI
108+
Please enter the FULL path to your custom ComfyUI below. Dough will use the models present in your personal ComfyUI
108109
for inference. It will also download the new models in your personal ComfyUI instance. Please note that
109110
Dough will maintain it's own copy of the nodes and packages to not cause any issues with the packages
110111
that might already be installed on your personal ComfyUI.
111112
112113
"""
113114
)
114-
h1, _ = st.columns([1, 1])
115+
116+
h1, h2 = st.columns([1, 1])
117+
with h2:
118+
st.info(
119+
"""
120+
IMPORTANT: After updating the path, please stop the app and restart for the changes to take place
121+
"""
122+
)
123+
115124
with h1:
116125
updated_path = st.text_input(
117126
"Custom ComfyUI path:",

ui_components/components/explorer_page.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -966,9 +966,11 @@ def gallery_image_view(project_uuid, shortlist=False, view=["main"], shot=None,
966966

967967
st.markdown("***")
968968
else:
969-
if st.session_state["page"] == "Shots":
969+
if shortlist:
970+
st.info("No images present. You can add images to the shortlist in the 'Inspiration Engine' tab.")
971+
else:
970972
st.info(
971-
"No images present. You can generate images by clicking into the 'Inspiration Engine' tab on the left."
973+
"No images present. You can generate images by clicking in the 'Inspiration Engine' section."
972974
)
973-
else:
974-
st.info("No images present. You can generate images above.")
975+
976+

ui_components/components/inspiraton_engine_page.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def inspiration_engine_page(shot_uuid: str, h2):
3131
with st.expander("🔍 Generation log", expanded=True):
3232
sidebar_logger(st.session_state["shot_uuid"])
3333

34+
35+
3436
st.write("")
3537
with st.expander("🪄 Shots", expanded=True):
3638
timeline_view(shot_uuid, "🪄 Shots", view="sidebar")

ui_components/components/timeline_view_page.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from utils import st_memory
77
from utils.data_repo.data_repo import DataRepo
88
from ui_components.widgets.sidebar_logger import sidebar_logger
9+
from ui_components.components.explorer_page import gallery_image_view
910

1011

1112
def timeline_view_page(shot_uuid: str, h2):
@@ -28,6 +29,17 @@ def timeline_view_page(shot_uuid: str, h2):
2829
with st.expander("🔍 Generation log", expanded=True):
2930
# if st_memory.toggle("Open", value=True, key="generaton_log_toggle"):
3031
sidebar_logger(st.session_state["shot_uuid"])
32+
33+
st.write("")
34+
35+
with st.expander("📋 Shortlist", expanded=True):
36+
if st_memory.toggle("Open", value=True, key="explorer_shortlist_toggle"):
37+
gallery_image_view(
38+
shot.project.uuid,
39+
shortlist=True,
40+
view=["add_and_remove_from_shortlist", "add_to_any_shot"],
41+
)
42+
3143

3244

3345

ui_components/widgets/inspiration_engine.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
# NOTE: since running locally is very slow (comfy startup, models loading, other gens in process..)
2626
# rn we are accessing the replicate API directly, will switch to some other local method in the future
2727

28+
2829
def check_replicate_key():
2930
data_repo = DataRepo()
3031
app_secrets = data_repo.get_app_secrets_from_user_uuid()
@@ -41,7 +42,7 @@ def check_replicate_key():
4142

4243
def edit_prompts(edit_text, list_of_prompts):
4344
# Convert list of prompts to a single string separated by '|'
44-
prompts_string = '|'.join(list_of_prompts)
45+
prompts_string = "|".join(list_of_prompts)
4546

4647
query_data = {
4748
"top_p": 0.9,
@@ -54,23 +55,23 @@ def edit_prompts(edit_text, list_of_prompts):
5455
"presence_penalty": 1.15,
5556
"stop_sequences": " ",
5657
}
57-
58+
5859
output = replicate.run(
5960
"meta/meta-llama-3-8b",
6061
input=query_data,
6162
)
6263

6364
proper_output = "" # Initialize an empty string to accumulate outputs
6465
for item in output:
65-
if isinstance(item, dict) and 'output' in item:
66-
proper_output += item['output'] # Concatenate each output to the proper_output string
66+
if isinstance(item, dict) and "output" in item:
67+
proper_output += item["output"] # Concatenate each output to the proper_output string
6768
else:
6869
proper_output += str(item) # Handle cases where item is not a dictionary
69-
70+
7071
list_of_prompts = proper_output.strip()
71-
list_of_prompts = list_of_prompts.lstrip('\n')
72+
list_of_prompts = list_of_prompts.lstrip("\n")
7273
# Proper output should be only before the first \n
73-
list_of_prompts = list_of_prompts.split("\n")[0]
74+
list_of_prompts = list_of_prompts.split("\n")[0]
7475

7576
return list_of_prompts
7677

@@ -100,14 +101,14 @@ def generate_prompts(
100101

101102
proper_output = "" # Initialize an empty string to accumulate outputs
102103
for item in output:
103-
if isinstance(item, dict) and 'output' in item:
104-
proper_output += item['output'] # Concatenate each output to the proper_output string
104+
if isinstance(item, dict) and "output" in item:
105+
proper_output += item["output"] # Concatenate each output to the proper_output string
105106
else:
106107
proper_output += str(item) # Handle cases where item is not a dictionary
107108
list_of_prompts = proper_output.strip()
108-
list_of_prompts = list_of_prompts.lstrip('\n')
109+
list_of_prompts = list_of_prompts.lstrip("\n")
109110
# Proper output should be only before the first \n
110-
list_of_prompts = proper_output.split("\n")[0]
111+
list_of_prompts = proper_output.split("\n")[0]
111112
return list_of_prompts
112113

113114

@@ -132,8 +133,8 @@ def inspiration_engine_element(project_uuid, position="explorer", shot_uuid=None
132133
style_reference_list = [
133134
{
134135
"name": "The Strangest Dream",
135-
"images": [
136-
"https://banodoco.s3.amazonaws.com/plan/strangest_dream_2.png",
136+
"images": [
137+
"https://banodoco-data-bucket-public.s3.ap-south-1.amazonaws.com/general_pics/strangest_dream_2.png",
137138
],
138139
"description": "Bold, dark colors, Dark Blue & red dominant, dream like, surreal.",
139140
"models_works_best_with": "Dreamshaper, Deliberate",
@@ -144,7 +145,7 @@ def inspiration_engine_element(project_uuid, position="explorer", shot_uuid=None
144145
{
145146
"name": "Green Hard Funk",
146147
"images": [
147-
"https://banodoco.s3.amazonaws.com/plan/green_hard_funk_1.png",
148+
"https://banodoco-data-bucket-public.s3.ap-south-1.amazonaws.com/general_pics/green_hard_funk_1.png",
148149
],
149150
"description": "Dominant green tones, red accents, high contrast, geometrical lining.",
150151
"models_works_best_with": "Dreamshaper, Deliberate",
@@ -155,7 +156,7 @@ def inspiration_engine_element(project_uuid, position="explorer", shot_uuid=None
155156
{
156157
"name": "Nordic Pale Blue",
157158
"images": [
158-
"https://banodoco.s3.amazonaws.com/plan/nordic_pale_blue_1.png",
159+
"https://banodoco-data-bucket-public.s3.ap-south-1.amazonaws.com/general_pics/nordic_pale_blue_1.png",
159160
],
160161
"description": "Pale blue, grey, pastel colors, ornamental and decorative details.",
161162
"models_works_best_with": "Dreamshaper, Deliberate",
@@ -166,7 +167,7 @@ def inspiration_engine_element(project_uuid, position="explorer", shot_uuid=None
166167
{
167168
"name": "Insane Animane",
168169
"images": [
169-
"https://banodoco.s3.amazonaws.com/plan/insane_animane_1.png",
170+
"https://banodoco-data-bucket-public.s3.ap-south-1.amazonaws.com/general_pics/insane_animane_1.png",
170171
],
171172
"description": "Detailed animation style, Blue, orange, white dominant, intense, expressive",
172173
"models_works_best_with": "Dreamshaper, Deliberate",
@@ -176,8 +177,8 @@ def inspiration_engine_element(project_uuid, position="explorer", shot_uuid=None
176177
},
177178
{
178179
"name": "Delicate Pink Glimmer",
179-
"images": [
180-
"https://banodoco.s3.amazonaws.com/plan/delicate_pink_2.png",
180+
"images": [
181+
"https://banodoco-data-bucket-public.s3.ap-south-1.amazonaws.com/general_pics/delicate_pink_2.png",
181182
],
182183
"description": "Delicate lines, soft colors, pink-blue & green dominant, misty/glimmer shine.",
183184
"models_works_best_with": "Deliberate, Realistic Vision",
@@ -560,21 +561,20 @@ def inspiration_engine_element(project_uuid, position="explorer", shot_uuid=None
560561
preview1, preview2, preview_3 = st.columns([1, 1, 1])
561562
with preview1:
562563
preset_images = items[[item["name"] for item in items].index(preset_style)]["images"]
563-
564+
564565
st.image(preset_images[0])
565-
566+
566567
with preview2:
567568
st.info(
568-
f"""**Recommended animation styling models:** {items[[item["name"] for item in items].index(preset_style)]["models_works_best_with"]}
569+
f"""**Recommended animation styling models:** {items[[item["name"] for item in items].index(preset_style)]["models_works_best_with"]}
569570
\n**Recommended workflow:** {items[[item["name"] for item in items].index(preset_style)]["workflows_works_best_with"]}
570571
\n**Created by:** {items[[item["name"] for item in items].index(preset_style)]["created_by"]}
571572
\n**Description:** {items[[item["name"] for item in items].index(preset_style)]["description"]}
572573
"""
573-
)
574+
)
574575

575-
with preview_3:
576+
with preview_3:
576577
st.video(items[[item["name"] for item in items].index(preset_style)]["example_video"])
577-
578578

579579
else:
580580
st.session_state["list_of_style_references"] = []
@@ -656,7 +656,7 @@ def inspiration_engine_element(project_uuid, position="explorer", shot_uuid=None
656656
help = ""
657657

658658
st.markdown("***")
659-
if st.button("Generate images", type="primary",disabled=button_status, help=help):
659+
if st.button("Generate images", type="primary", disabled=button_status, help=help):
660660

661661
if type_of_style_input == "Choose From List":
662662
st.session_state["list_of_style_references"] = preset_images

0 commit comments

Comments
 (0)