Skip to content

Commit bef900b

Browse files
committed
make copilot workflow image to rounded-circle border
1 parent 9d0eeff commit bef900b

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

daras_ai_v2/base.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,8 @@ def render(self):
374374
self._render_header()
375375

376376
def _render_header(self):
377+
from widgets.workflow_image import CIRCLE_IMAGE_WORKFLOWS
378+
377379
sr, pr = self.current_sr_pr
378380
is_example = pr.saved_run == sr
379381
is_root_example = is_example and pr.is_root()
@@ -416,16 +418,20 @@ def _render_header(self):
416418
gui.div(
417419
className="d-flex mt-4 mt-md-2 flex-column flex-md-row align-items-center gap-4 container-margin-reset"
418420
),
419-
):
421+
):
422+
imageStyles = dict(
423+
maxWidth="150px",
424+
height="150px",
425+
margin=0,
426+
minHeight="150px",
427+
objectFit="cover",
428+
)
429+
if self.workflow in CIRCLE_IMAGE_WORKFLOWS:
430+
imageStyles["borderRadius"] = "50%"
431+
420432
gui.image(
421433
src=pr.photo_url,
422-
style=dict(
423-
width="150px",
424-
height="150px",
425-
margin=0,
426-
minHeight="150px",
427-
objectFit="cover",
428-
),
434+
style=imageStyles,
429435
)
430436
with gui.div(className="d-flex gap-2 w-100"):
431437
with gui.div(className="flex-grow-1"):

widgets/workflow_image.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
render_ai_generated_image_widget,
1010
)
1111
from workspaces.models import Workspace
12+
from bots.models import Workflow
1213

14+
CIRCLE_IMAGE_WORKFLOWS = [Workflow.VIDEO_BOTS]
1315

1416
def render_workflow_photo_uploader(
1517
workspace: Workspace,
@@ -30,6 +32,7 @@ def render_workflow_photo_uploader(
3032
is_generating=is_generating,
3133
error_msg=error_msg,
3234
icon=icons.photo,
35+
is_circle_image=pr.workflow in CIRCLE_IMAGE_WORKFLOWS,
3336
)
3437
if pressed_generate:
3538
gui.session_state[key + ":bot-channel"] = run_icon_bot(
@@ -52,19 +55,6 @@ def render_change_notes_input(key: str):
5255
)
5356

5457

55-
def workflow_photo_div(url: str | None):
56-
return gui.div(
57-
style=dict(
58-
aspectRatio="1",
59-
width="80%",
60-
backgroundImage=f"url({url})" if url else "none",
61-
backgroundSize="cover",
62-
backgroundPosition="center",
63-
),
64-
className="d-flex align-items-center justify-content-center p-5 bg-light b-1 border rounded",
65-
)
66-
67-
6858
PROMPT_FORMAT = '''\
6959
Title: %s
7060
Description: """

widgets/workflow_metadata_gen.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def render_ai_generated_image_widget(
1212
is_generating: bool,
1313
error_msg: Optional[str],
1414
icon: str,
15+
is_circle_image: bool = False,
1516
) -> bool:
1617
"""
1718
Renders a reusable AI-generated image widget with preview, error, upload, and action buttons.
@@ -39,9 +40,15 @@ def render_ai_generated_image_widget(
3940
else:
4041
img_style = dict()
4142

43+
img_classes = "d-flex align-items-center justify-content-center bg-light b-1 border"
44+
if is_circle_image:
45+
img_classes += " rounded-circle"
46+
else:
47+
img_classes += " rounded"
48+
4249
with gui.div(
4350
style=dict(height="200px", width="200px") | img_style,
44-
className="d-flex align-items-center justify-content-center bg-light b-1 border rounded",
51+
className=img_classes,
4552
):
4653
if is_generating:
4754
with gui.styled(

0 commit comments

Comments
 (0)