sd_tool_usage.py
1 # -*- coding: utf-8 -*- 2 # @Date : 1/11/2024 7:06 PM 3 # @Author : stellahong (stellahong@fuzhi.ai) 4 # @Desc : 5 import asyncio 6 7 from metagpt.roles.di.data_interpreter import DataInterpreter 8 9 10 async def main(requirement: str = ""): 11 di = DataInterpreter(tools=["SDEngine"]) 12 await di.run(requirement) 13 14 15 if __name__ == "__main__": 16 sd_url = "http://your.sd.service.ip:port" 17 requirement = ( 18 f"I want to generate an image of a beautiful girl using the stable diffusion text2image tool, sd_url={sd_url}" 19 ) 20 21 asyncio.run(main(requirement))