Skip to content

Commit

Permalink
add simulation ui params (#63)
Browse files Browse the repository at this point in the history
* add gradio params
  • Loading branch information
JetSquirrel authored Oct 15, 2023
1 parent 3af33f8 commit 5292621
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 3 additions & 2 deletions agentverse/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ class GUI:
the UI of frontend
"""

def __init__(self, task: str, tasks_dir: str):
def __init__(self, task: str, tasks_dir: str,ui_kwargs: Dict[str, str]):
"""
init a UI.
default number of students is 0
"""
self.messages = []
self.task = task
self.ui_kwargs = ui_kwargs
if task == "pipeline_brainstorming":
self.backend = TaskSolving.from_task(task, tasks_dir)
else:
Expand Down Expand Up @@ -502,5 +503,5 @@ def respond(message, chat_history):
show_progress=False,
)

demo.queue(concurrency_count=5, max_size=20).launch()
demo.queue(concurrency_count=5, max_size=20).launch(**self.ui_kwargs)
# demo.launch()
13 changes: 10 additions & 3 deletions agentverse_command/main_simulation_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@
type=str,
default=os.path.join(os.path.dirname(__file__), "..", "agentverse", "tasks"),
)
args = parser.parse_args()
parser.add_argument("--share",
action='store_true',
default=False,
help="Create a publicly shareable link")
parser.add_argument("--server_name",
type=str,
default="127.0.0.1",
help="Server name")

args = parser.parse_args()

def cli_main():
ui = GUI(args.task, args.tasks_dir)
ui = GUI(args.task, args.tasks_dir,ui_kwargs={"share":args.share,"server_name":args.server_name})
ui.launch()


if __name__ == "__main__":
cli_main()

0 comments on commit 5292621

Please sign in to comment.