Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference image support for QR code generation #222

Closed
wants to merge 164 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
3d7b416
include calendar url in urls
SanderGi Nov 7, 2023
33fe11a
pretty replicate buttons with radio interface
SanderGi Nov 7, 2023
bc45093
emoji update
SanderGi Nov 7, 2023
edb9a0a
use active class instead of hardcoded styles
SanderGi Nov 7, 2023
86ecc15
fix meta preview image
SanderGi Nov 7, 2023
15c61f1
added non square resolutions for dalle3
SanderGi Nov 14, 2023
33ef6c0
add sd and hd settings
SanderGi Nov 14, 2023
060805c
Add countdown timer component
nikochiko Nov 14, 2023
f2bec72
update deepgram supported lang list
SanderGi Nov 21, 2023
2344a9f
remove azure asr autodetect since it is extremely slow and does not p…
SanderGi Nov 21, 2023
4b62dab
longer polling wait
SanderGi Nov 21, 2023
6acb7b9
Add UI component for save menu
nikochiko Nov 24, 2023
b2d0349
added reference image support via controlnets
SanderGi Nov 27, 2023
79d1f42
Merge branch 'master' into published-runs
nikochiko Nov 27, 2023
8ae5705
cleaned up auto_detect support logic
SanderGi Nov 27, 2023
9afe191
split dalle_3 style and quality inputs
SanderGi Nov 27, 2023
1370e08
Merge branch 'master' into vcard_improvements
SanderGi Nov 27, 2023
cb348d7
fix merge
SanderGi Nov 27, 2023
c7581a6
Fix allow additional class names for buttons
nikochiko Nov 28, 2023
549d058
Update README.md
devxpy Nov 28, 2023
ddbbfc5
gooey-ui: Allow unchecked radio buttons with flag
nikochiko Nov 28, 2023
6e96a0a
Add published run UX
nikochiko Nov 28, 2023
8926c16
Return created_at/updated_at as datetime from db models
nikochiko Nov 28, 2023
8a09bd6
Fix datetime usage in bsae.py
nikochiko Nov 28, 2023
2a9c2cb
Use recipe run state enum
nikochiko Nov 28, 2023
a8be21e
Merge branch 'master' into timer
nikochiko Nov 28, 2023
4d46ed1
Format base.py better
nikochiko Nov 28, 2023
2afa4e2
Fix modal component: close button and padding
nikochiko Nov 29, 2023
04c5713
Fix default title for published run
nikochiko Nov 29, 2023
c671a35
Fix type-casting for published-run visibility
nikochiko Nov 29, 2023
240c0df
Reorder update/three-dots UI
nikochiko Nov 29, 2023
f4a9172
azure form recognizer & gpt-4-v support
devxpy Nov 21, 2023
b5e83e5
fix msg history in copilot when sending images
devxpy Nov 29, 2023
505006d
copy_to_clipboard_button now takes a button type as argument
nikochiko Nov 30, 2023
4b8d2cb
move copy-to-clipboard button to ... actions menu
nikochiko Nov 30, 2023
310ec0d
Split logic for getting and rendering title/breadcrumbs
nikochiko Nov 30, 2023
97fdeb3
Add unpublished changes indicator for published runs
nikochiko Nov 30, 2023
b812813
Add author in breadcrumbs row
nikochiko Nov 30, 2023
ebe1ec6
Make update/save icon same and add create_published_run method
nikochiko Nov 30, 2023
846f782
rename run_action_buttons to published_run_buttons
nikochiko Nov 30, 2023
fc776cd
Cleanup get_title_and_breadcrumbs logic to use current_run, published…
nikochiko Nov 30, 2023
3750f08
Only show unpublished changes indicator when current user is publishe…
nikochiko Nov 30, 2023
f129f5d
Add published tab
nikochiko Nov 30, 2023
f893f6b
Merge pull request #212 from GooeyAI/timer
devxpy Nov 30, 2023
433101a
preview input in admin
devxpy Dec 1, 2023
8017d85
preview input in admin
devxpy Dec 1, 2023
b46c187
remove hack
SanderGi Dec 3, 2023
ed20fe2
concise className assignment
SanderGi Dec 3, 2023
d14a61b
replace radio hash input
SanderGi Dec 3, 2023
a77f7ec
rename dalle to dall_e
SanderGi Dec 3, 2023
ab3231b
move autodetect check logic to enum
SanderGi Dec 3, 2023
d854ad1
fix typo
SanderGi Dec 3, 2023
4d5c02f
Add schema changes for published run table and use published run in b…
nikochiko Dec 4, 2023
e781239
Fix author image, breadcrumbs, and icons for responsiveness
nikochiko Dec 4, 2023
e353b9b
Change ellipsis button and hide unpublished changes in mobile view
nikochiko Dec 4, 2023
873cfe1
fix api for unset body
devxpy Dec 4, 2023
986e203
fix typo
devxpy Dec 4, 2023
a5fe8ea
Add changes for better responsiveness
nikochiko Dec 4, 2023
99d347a
Use get_published_run instead of example_doc_sr in safety_checker
nikochiko Dec 4, 2023
1abe555
Add duplicate and delete buttons
nikochiko Dec 4, 2023
82cdea2
Merge pull request #211 from GooeyAI/dalle_3_support_resolutions
devxpy Dec 4, 2023
34028b8
Merge pull request #206 from GooeyAI/vcard_improvements
devxpy Dec 4, 2023
65a0248
Add support for showing version history
nikochiko Dec 4, 2023
901bb8e
Merge pull request #216 from GooeyAI/asr_bug_fixes
devxpy Dec 4, 2023
e5aad33
Added new photos
clr-li Nov 22, 2023
75d35e5
Fixed css of images
clr-li Nov 22, 2023
5763c74
Split featured and non featured
clr-li Nov 22, 2023
86e511e
Fixes
clr-li Nov 27, 2023
4e8aa1c
Made Images section 3 columns
clr-li Nov 27, 2023
4b69025
Show number of runs on each workflow
clr-li Nov 29, 2023
418c9c1
Deleted unnecessary code
clr-li Nov 29, 2023
4b2f68d
Pro Font Awesome icons
clr-li Nov 30, 2023
efa8cc9
Show runs on all workflows
clr-li Dec 1, 2023
b31dfaa
Simplified
clr-li Dec 1, 2023
356c3cd
Commented out run count for now
clr-li Dec 4, 2023
e6d6ec4
Commented out
clr-li Dec 4, 2023
2948774
fix type error on bulk runner
devxpy Dec 4, 2023
1f0adf2
fix image links on /explore
devxpy Dec 4, 2023
b51281c
Force redirect upon workflow publish
nikochiko Dec 4, 2023
4084f38
Fix version history and timestamp view
nikochiko Dec 4, 2023
cc497af
Rename 'actions' to 'options'
nikochiko Dec 4, 2023
d869cd2
Fix date rendering in version history
nikochiko Dec 4, 2023
7dae537
Add confirmation modal after delete is pressed
nikochiko Dec 4, 2023
773773f
Redo version history view
nikochiko Dec 5, 2023
01d406e
copy_to_clipboard_button: fix bug where icons are lost after clicking
nikochiko Dec 5, 2023
df11e94
Reorder buttons and set button styles
nikochiko Dec 5, 2023
fc8eef0
Cleanup migrations to only include relevant changes
nikochiko Dec 5, 2023
5d523da
Remove StateKeys.page_title and StateKeys.page_notes
nikochiko Dec 5, 2023
843d34e
Merge branch 'master' into published-runs
nikochiko Dec 5, 2023
7805721
Merge branch 'master' into published-runs
nikochiko Dec 5, 2023
f1ced7a
Move components.py to components/__init__.py
nikochiko Dec 5, 2023
f95a5ae
Add page_image to StateKeys
nikochiko Dec 5, 2023
627346a
Fix button spacing
nikochiko Dec 5, 2023
415fda9
Add default value for published_run_notes to carry over notes between…
nikochiko Dec 5, 2023
9a07c95
Reorder migrations after merge with conflicting migrations from master
nikochiko Dec 5, 2023
2101c64
Add published run to bot integrations
nikochiko Dec 5, 2023
7486caf
Fix migrations for published runs
nikochiko Dec 5, 2023
11d5ab5
migrations: reject hidden examples as unapproved
nikochiko Dec 5, 2023
c70c39d
show run/error in history
devxpy Dec 6, 2023
e4bb3f8
add fixture to get bot integrations
devxpy Dec 7, 2023
77da550
fix: KeyError '__pixels'
devxpy Dec 7, 2023
da23275
remove bot script parsing, because people won't stop using colons in …
devxpy Dec 7, 2023
4630222
fix translation issue
devxpy Dec 7, 2023
805f3c2
playwright docker
devxpy Dec 7, 2023
aba5298
playwright install-deps
devxpy Dec 7, 2023
f0cd1fa
Fix bots usage with published runs
nikochiko Dec 8, 2023
2224e3b
Add admin page for published run version
nikochiko Dec 8, 2023
39237f2
Add parent_version to SavedRun
nikochiko Dec 8, 2023
c0e0ada
fix bulk runner returning None
devxpy Dec 8, 2023
055c87c
Fix breadcrumbs and not use example_id when run_id is there in params
nikochiko Dec 8, 2023
bd46ded
Merge branch 'master' into published-runs
nikochiko Dec 8, 2023
1ce7978
Add help note for published_run_id and indexes for PublishedRun and r…
nikochiko Dec 11, 2023
6112400
don't use glossary when translating image text
devxpy Dec 11, 2023
2f3922c
bulk eval
devxpy Dec 11, 2023
7311396
fix telugu text in bulk eval
devxpy Dec 11, 2023
b7da177
Add Save as New button for runs with unpublished changes
nikochiko Dec 12, 2023
7e75270
handle UnicodeDecodeError
devxpy Dec 12, 2023
f473bc1
Rename published -> save in view
nikochiko Dec 13, 2023
63986f7
Merge branch 'master' into published-runs
nikochiko Dec 13, 2023
0d6d5f0
Silently create root published run for new recipes
nikochiko Dec 13, 2023
a6674a1
Changed workflow meta images
clr-li Dec 6, 2023
b2b080b
implemented
SanderGi Nov 27, 2023
a3bee03
rename replicate to openai
SanderGi Nov 27, 2023
d360f81
remove redundant ffmpeg calls
devxpy Dec 13, 2023
0b56bcb
Escape HTML in gooey-ui markdown and write components
nikochiko Dec 12, 2023
6bc93b3
Fix remaining unsafe_allow_html conditions
nikochiko Dec 14, 2023
245033d
Changed image links
clr-li Dec 4, 2023
ee98879
Adding margin on the bottom on workflows
clr-li Dec 7, 2023
84ed3d6
Changed email profile workflow image
clr-li Dec 7, 2023
c9435e2
Email face inpainting meta image
clr-li Dec 7, 2023
20d7b01
Added unique users column
clr-li Dec 10, 2023
0656162
Added pie chart
clr-li Dec 10, 2023
4d47983
Checkbox toggle
clr-li Dec 11, 2023
94c99a8
Explore page fixes
clr-li Dec 13, 2023
8e7f555
Redirect anonymous users to /login on trying to Save a run
nikochiko Dec 14, 2023
9fcbccb
Only show saved tab to non anonymous users
nikochiko Dec 14, 2023
e5ba772
add bulk eval metadata
devxpy Dec 14, 2023
6126e6f
Merge branch 'master' into published-runs
nikochiko Dec 14, 2023
c4d7288
11labs: Add style exaggeration, speaker boost settings, and multiling…
nikochiko Dec 16, 2023
8d4243f
Set step=0.05 for style exaggeration slider
nikochiko Dec 16, 2023
aad7c63
Fix render_running_output: repeated output
nikochiko Dec 19, 2023
41bacbe
Exclude root published run from examples
nikochiko Dec 19, 2023
b301179
Allow setting pub-run title to root title when pub-run is root
nikochiko Dec 19, 2023
da835fb
Merge branch 'master' into published-runs
nikochiko Dec 19, 2023
f8bc27c
Undo lost changes for countdown timer
nikochiko Dec 19, 2023
c839d91
Add autocomplete fields for FKs
nikochiko Dec 19, 2023
37574e0
better table rendering of bulk eval results
devxpy Dec 18, 2023
9ae1301
renamed to image_prompt_strength
SanderGi Dec 20, 2023
59dc9ea
scale and reposition setting
SanderGi Dec 20, 2023
8f1c786
simplified google translate fix, won't disallow unsuported langs from ui
SanderGi Dec 20, 2023
a10b5f0
removed test code
SanderGi Dec 20, 2023
5538e78
Merge branch 'master' of github.com:dara-network/ddgai into published…
devxpy Dec 21, 2023
0613ad6
migrate
devxpy Dec 21, 2023
0a15d9f
Fix get_recipe_title usage
nikochiko Dec 21, 2023
479239e
Merge pull request #225 from GooeyAI/published-runs
devxpy Dec 26, 2023
93715d3
mark example_id, page_title and page_notes as deprecated in admin
devxpy Dec 26, 2023
80ae2de
Fix z-index for modals
nikochiko Dec 27, 2023
3308612
Merge pull request #240 from GooeyAI/modal-zindex
devxpy Dec 29, 2023
cf18154
Small note in readme
SeanBlagsvedt Dec 30, 2023
77626e3
added reference image support via controlnets
SanderGi Nov 27, 2023
213cc80
renamed to image_prompt_strength
SanderGi Dec 20, 2023
ce0446b
scale and reposition setting
SanderGi Dec 20, 2023
4596e15
update input titles in qr code recipe
devxpy Dec 31, 2023
aa1a753
Merge remote-tracking branch 'origin/qr_with_reference_image' into qr…
devxpy Dec 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions daras_ai_v2/stable_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def controlnet(
scheduler: str = None,
prompt: str,
num_outputs: int = 1,
init_image: str,
init_images: list[str] | str,
num_inference_steps: int = 50,
negative_prompt: str = None,
guidance_scale: float = 7.5,
Expand All @@ -411,6 +411,8 @@ def controlnet(
):
if isinstance(selected_controlnet_model, str):
selected_controlnet_model = [selected_controlnet_model]
if isinstance(init_images, str):
init_images = [init_images] * len(selected_controlnet_model)
prompt = add_prompt_prefix(prompt, selected_model)
return call_sd_multi(
"diffusion.controlnet",
Expand All @@ -432,7 +434,7 @@ def controlnet(
"num_images_per_prompt": num_outputs,
"num_inference_steps": num_inference_steps,
"guidance_scale": guidance_scale,
"image": [init_image] * len(selected_controlnet_model),
"image": init_images,
"controlnet_conditioning_scale": controlnet_conditioning_scale,
# "strength": prompt_strength,
},
Expand Down
2 changes: 1 addition & 1 deletion recipes/Img2Img.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def run(self, state: dict) -> typing.Iterator[str | None]:
selected_controlnet_model=request.selected_controlnet_model,
prompt=request.text_prompt,
num_outputs=request.num_outputs,
init_image=init_image,
init_images=init_image,
num_inference_steps=request.quality,
negative_prompt=request.negative_prompt,
guidance_scale=request.guidance_scale,
Expand Down
57 changes: 56 additions & 1 deletion recipes/QRCodeGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from recipes.EmailFaceInpainting import get_photo_for_email
from recipes.SocialLookupEmail import get_profile_for_email
from url_shortener.models import ShortenedURL
from daras_ai_v2.enum_selector_widget import enum_multiselect

ATTEMPTS = 1
DEFAULT_QR_CODE_META_IMG = "https://storage.googleapis.com/dara-c1b52.appspot.com/daras_ai/media/f09c8cfa-5393-11ee-a837-02420a000190/ai%20art%20qr%20codes1%201.png.png"
Expand All @@ -59,6 +60,12 @@ class QRCodeGeneratorPage(BasePage):
obj_scale=0.65,
obj_pos_x=0.5,
obj_pos_y=0.5,
image_prompt_controlnet_models=[
ControlNetModels.sd_controlnet_canny.name,
ControlNetModels.sd_controlnet_depth.name,
ControlNetModels.sd_controlnet_tile.name,
],
inspiration_strength=0.3,
)

def __init__(self, *args, **kwargs):
Expand All @@ -75,6 +82,11 @@ class RequestModel(BaseModel):

text_prompt: str
negative_prompt: str | None
image_prompt: str | None
SanderGi marked this conversation as resolved.
Show resolved Hide resolved
image_prompt_controlnet_models: list[
typing.Literal[tuple(e.name for e in ControlNetModels)], ...
] | None
inspiration_strength: float | None
SanderGi marked this conversation as resolved.
Show resolved Hide resolved

selected_model: typing.Literal[tuple(e.name for e in Text2ImgModels)] | None
selected_controlnet_model: list[
Expand Down Expand Up @@ -129,6 +141,14 @@ def render_form_v2(self):
key="text_prompt",
placeholder="Bright sunshine coming through the cracks of a wet, cave wall of big rocks",
)
st.file_uploader(
"""
### 🏞️ Reference Image [optional]
This image will be used as inspiration to blend with the QR Code.
""",
key="image_prompt",
accept=["image/*"],
)

qr_code_source_key = "__qr_code_source"
if qr_code_source_key not in st.session_state:
Expand Down Expand Up @@ -320,6 +340,30 @@ def render_settings(self):
color=255,
)

if st.session_state.get("image_prompt"):
st.write("---")
st.write(
"""
##### 🎨 Inspiration
Use this to control how the image prompt should influence the output.
""",
className="gui-input",
)
st.slider(
"Inspiration Strength",
min_value=0.0,
max_value=1.0,
step=0.05,
key="inspiration_strength",
)
enum_multiselect(
ControlNetModels,
label="Control Net Models",
key="image_prompt_controlnet_models",
checkboxes=False,
allow_none=False,
)

def render_output(self):
state = st.session_state
self._render_outputs(state)
Expand Down Expand Up @@ -376,11 +420,22 @@ def run(self, state: dict) -> typing.Iterator[str | None]:
state["raw_images"] = raw_images = []

yield f"Running {Text2ImgModels[request.selected_model].value}..."
if isinstance(request.selected_controlnet_model, str):
request.selected_controlnet_model = [request.selected_controlnet_model]
init_images = [image] * len(request.selected_controlnet_model)
if request.image_prompt:
init_images += [request.image_prompt] * len(
request.image_prompt_controlnet_models
)
request.selected_controlnet_model += request.image_prompt_controlnet_models
SanderGi marked this conversation as resolved.
Show resolved Hide resolved
request.controlnet_conditioning_scale += [
request.inspiration_strength
] * len(request.image_prompt_controlnet_models)
state["output_images"] = controlnet(
selected_model=request.selected_model,
selected_controlnet_model=request.selected_controlnet_model,
prompt=request.text_prompt,
init_image=image,
init_images=init_images,
num_outputs=request.num_outputs,
num_inference_steps=request.quality,
negative_prompt=request.negative_prompt,
Expand Down
2 changes: 1 addition & 1 deletion scripts/run_all_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
selected_controlnet_model=controlnet_model.name,
prompt=get_random_string(100, string.ascii_letters),
num_outputs=4,
init_image=random_img,
init_images=random_img,
num_inference_steps=1,
guidance_scale=7,
),
Expand Down
Loading