-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c68e39
commit 6bf3275
Showing
4 changed files
with
93 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import unittest | ||
|
||
|
||
class TestText2Image(unittest.TestCase): | ||
|
||
def setUp(self): | ||
from agi.llms.speech2text import Speech2Text | ||
from agi.llms.base import MultiModalMessage,Audio | ||
import torch | ||
self.instance = Speech2Text() | ||
self.input = MultiModalMessage(content="a midlife crisis man") | ||
|
||
def test_image2image(self): | ||
output = self.instance.invoke(self.input) | ||
self.assertIsNotNone(output) | ||
self.assertIsNotNone(output.image) | ||
self.assertIsNotNone(output.image.pil_image) | ||
self.assertIsNotNone(output.content) | ||
print(output.content) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import unittest | ||
|
||
|
||
class TestTextToSpeech(unittest.TestCase): | ||
|
||
def setUp(self): | ||
from agi.llms.tts import TextToSpeech | ||
from agi.llms.base import MultiModalMessage,Audio | ||
import torch | ||
self.instance = TextToSpeech() | ||
print(self.instance.list_available_models()) | ||
content = ''' | ||
以下是每个缩写的简要解释: | ||
hag: Hanga — 指的是一种语言,主要在巴布亚新几内亚的Hanga地区使用。 | ||
hnn: Hanunoo — 指的是菲律宾的一种语言,主要由Hanunoo人使用,属于马来-波利尼西亚语系。 | ||
bgc: Haryanvi — 指的是印度哈里亚纳邦的一种方言,属于印地语的一种变体。 | ||
had: Hatam — 指的是巴布亚新几内亚的一种语言,主要在Hatam地区使用。 | ||
hau: Hausa — 指的是西非的一种语言,广泛用于尼日利亚和尼日尔,是主要的交易语言之一。 | ||
hwc: Hawaii Pidgin — 指的是夏威夷的一种克里奥尔语,受英语和夏威夷土著语言影响,常用于当地的日常交流。 | ||
hvn: Hawu — 指的是印度尼西亚的一种语言,主要在西努沙登加拉省的Hawu地区使用。 | ||
hay: Haya — 指的是坦桑尼亚的一种语言,由Haya人使用,属于尼日尔-刚果语系。 | ||
''' | ||
self.input = MultiModalMessage(content=content) | ||
|
||
def test_text2speech(self): | ||
output = self.instance.invoke(self.input) | ||
self.assertIsNotNone(output) | ||
self.assertIsNotNone(output.audio) | ||
self.assertIsNotNone(output.audio.file_path) | ||
self.assertIsNotNone(output.content) | ||
print(output.content) | ||
print(output.audio.file_path) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |