우연히
1.0.0
Perchance용 비공식 Python API.
이 모듈을 설치하려면 다음 명령을 실행하십시오.
pip install perchance
import asyncio
import perchance
async def main ():
gen = perchance . TextGenerator ()
prompt = "How far is the moon?"
async for chunk in gen . text ( prompt ):
print ( chunk , end = '' )
asyncio . run ( main ())
import asyncio
import perchance
from PIL import Image
async def main ():
gen = perchance . ImageGenerator ()
prompt = "Fantasy landscape"
async with await gen . image ( prompt ) as result :
binary = await result . download ()
image = Image . open ( binary )
image . show ()
asyncio . run ( main ())