Skip to content

Commit

Permalink
fix: remove image_urls in gallery and multi-input for temp (modelscop…
Browse files Browse the repository at this point in the history
  • Loading branch information
zhijianma authored Sep 9, 2024
1 parent 6fc2ec8 commit 2287365
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion gallery/meme.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@
"name": "ImageComposition",
"data": {
"args": {
"image_urls": [],
"titles": "['我的朋友认为我...', '我的父母认为我...', '实际上我...']",
"output_path": "meme.jpg",
"row": 1,
Expand Down
1 change: 0 additions & 1 deletion gallery/story.json
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@
"name": "ImageComposition",
"data": {
"args": {
"image_urls": [],
"titles": "[\"第一幕\", \"第二幕\", \"第三幕\", \"第四幕\"]",
"output_path": "test.png",
"row": 2,
Expand Down
1 change: 0 additions & 1 deletion src/agentscope/studio/static/js/workstation.js
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,6 @@ async function addNodeToDrawFlow(name, pos_x, pos_y) {
editor.addNode('ImageComposition', 1, 1,
pos_x, pos_y, 'ImageComposition', {
"args": {
"image_urls": [],
"titles": "",
"output_path": "",
"row": 1,
Expand Down
4 changes: 3 additions & 1 deletion src/agentscope/web/workstation/workflow_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@ def run(self) -> None:
]
if not inputs:
values[node_id] = self.exec_node(node_id)
elif len(inputs):
elif len(inputs) == 1:
# Note: only support exec with the first predecessor now
values[node_id] = self.exec_node(node_id, inputs[0])
elif len(inputs) > 1:
values[node_id] = self.exec_node(node_id, inputs)
else:
raise ValueError("Too many predecessors!")

Expand Down
8 changes: 5 additions & 3 deletions src/agentscope/web/workstation/workflow_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from abc import ABC, abstractmethod
from enum import IntEnum
from functools import partial
from typing import List, Optional
from typing import List, Optional, Any

from agentscope import msghub
from agentscope.agents import (
Expand Down Expand Up @@ -95,7 +95,7 @@ def __init__(
if is_callable_expression(value):
self.opt_kwargs[key] = convert_str_to_callable(value)

def __call__(self, x: dict = None): # type: ignore[no-untyped-def]
def __call__(self, x: Any = None): # type: ignore[no-untyped-def]
"""
Invokes the node's operations with the provided input.
Expand Down Expand Up @@ -1087,7 +1087,9 @@ def __init__(
)
self.pipeline = partial(stitch_images_with_grid, **self.opt_kwargs)

def __call__(self, x: dict = None) -> dict:
def __call__(self, x: list = None) -> dict:
if isinstance(x, dict):
x = [x]
return self.pipeline(x)

def compile(self) -> dict:
Expand Down

0 comments on commit 2287365

Please sign in to comment.