Skip to content

Commit

Permalink
modify import method
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyijunlyy committed Jan 9, 2024
1 parent 316931b commit 0c966d0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 19 deletions.
2 changes: 1 addition & 1 deletion tests/tools/test_image_gen.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from modelscope_agent.agent import Agent
from modelscope_agent.tools.image_generation import TextToImageTool
from modelscope_agent.tools import TextToImageTool

from modelscope_agent.agents.role_play import RolePlay # NOQA

Expand Down
2 changes: 1 addition & 1 deletion tests/tools/test_local_tools.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from modelscope_agent.tools import ModelscopePipelineTool, Tool
from modelscope_agent.tools import ModelscopePipelineTool


def test_modelscope_pipline():
Expand Down
12 changes: 6 additions & 6 deletions tests/tools/test_modelscope_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def test_modelscope_speech_generation():
from modelscope_agent.tools.text_to_speech_tool import TexttoSpeechTool
from modelscope_agent.tools import TexttoSpeechTool
input = '北京今天天气怎样?'
kwargs = {'input': input, 'gender': 'man'}
txt2speech = TexttoSpeechTool(cfg)
Expand All @@ -17,7 +17,7 @@ def test_modelscope_speech_generation():


def test_modelscope_text_address():
from modelscope_agent.tools.text_address_tool import TextAddressTool
from modelscope_agent.tools import TextAddressTool
input = '北京朝阳望京东金辉大厦'
kwargs = {'input': input}
txt_addr = TextAddressTool(cfg)
Expand All @@ -27,7 +27,7 @@ def test_modelscope_text_address():


def test_modelscope_text_ner():
from modelscope_agent.tools.text_ner_tool import TextNerTool
from modelscope_agent.tools import TextNerTool
input = '北京今天天气怎样?'
kwargs = {'input': input}
txt_ner = TextNerTool(cfg)
Expand All @@ -37,7 +37,7 @@ def test_modelscope_text_ner():


def test_modelscope_video_generation():
from modelscope_agent.tools.text_to_video_tool import TextToVideoTool
from modelscope_agent.tools import TextToVideoTool
input = '一个正在打篮球的人'
kwargs = {'text': input}
video_gen = TextToVideoTool(cfg)
Expand All @@ -47,7 +47,7 @@ def test_modelscope_video_generation():


def test_modelscope_zh2en():
from modelscope_agent.tools.translation_zh2en_tool import TranslationZh2EnTool
from modelscope_agent.tools import TranslationZh2EnTool
input = '北京今天天气怎样?'
kwargs = {'input': input}
zh_to_en = TranslationZh2EnTool(cfg)
Expand All @@ -57,7 +57,7 @@ def test_modelscope_zh2en():


def test_modelscope_en2zh():
from modelscope_agent.tools.translation_en2zh_tool import TranslationEn2ZhTool
from modelscope_agent.tools import TranslationEn2ZhTool
input = 'Autonomous agents have long been a prominent research focus in both academic and industry communities.'
kwargs = {'input': input}
en_to_zh = TranslationEn2ZhTool(cfg)
Expand Down
12 changes: 7 additions & 5 deletions tests/tools/test_pipeline_tool.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
from modelscope_agent.tools.pipeline_tool import ModelscopePipelineTool
from modelscope.utils.config import Config
import os

from modelscope_agent.tools import ModelscopePipelineTool

from modelscope.utils.config import Config

cfg = Config.from_file('config/cfg_tool_template.json')
# 请用自己的SDK令牌替换{YOUR_MODELSCOPE_SDK_TOKEN}(包括大括号)
os.environ['MODELSCOPE_API_KEY'] = f"{YOUR_MODELSCOPE_SDK_TOKEN}"
os.environ['MODELSCOPE_API_KEY'] = f'{YOUR_MODELSCOPE_SDK_TOKEN}'


def test_modelscope_speech_generation():
from modelscope_agent.tools.text_to_speech_tool import TexttoSpeechTool
from modelscope_agent.tools import TexttoSpeechTool
kwargs = """{'input': '北京今天天气怎样?', 'gender': 'man'}"""
txt2speech = TexttoSpeechTool(cfg)
res = txt2speech.call(kwargs)
print(res)


test_modelscope_speech_generation()

7 changes: 1 addition & 6 deletions tests/tools/test_style_repaint.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import os

from modelscope_agent.agent import Agent
from modelscope_agent.tools.style_repaint import StyleRepaint

print(os.getcwd())
from modelscope_agent.tools import StyleRepaint

from modelscope_agent.agents.role_play import RolePlay # NOQA

Expand Down

0 comments on commit 0c966d0

Please sign in to comment.