Hello everyone , This is Wang Feng, a programmer .
Python The official website of automated office has been released : https://www.python-office.com/
Last time I shared with you : A cartoon Avatar 50 element ?1 That's ok Python Code implementation , Stop paying the IQ tax
Everyone loves this feature , This function will be implemented in a short time 200 Trial runs out . If you make the following error report , Explain that there is no problem with your program itself , I just ran out of trials .
Today I will add an advanced version to you , Make sure everyone can use ~
Easy to install , There is python On the computer of the environment , Just execute the following command line .
If you have used python-office This library , You also need to perform , You can download to the latest version ~
install
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple python-office -U
Go straight to the code ! Code
# Import this library :python-office, Shorthand for office
import office
office.image.img2Cartoon(path='',client_api=' Yours api key', client_secret=' Yours secret key')
# Parameter description :
# path: Where to store your own live photos + PDF The name of the file , for example :d://image// Programmer Wanfeng .jpg
# client_api: ' Yours api key'
# client_secret: ' Yours secret key'
Run the above code directly , You will get a converted cartoon avatar .
The program may need to run 20 About seconds .
I believe careful friends have found , The difference between this latest version and the last one is : More `clinet_api and client_secret
` this 2 Parameters .
this 2 The first parameter is Baidu AI Platform , Everyone 200 Free calls .
This is why people reported errors in the previous version : Because I have provided you with my own 200 Trial times , It has been used up .
It's easy to open a free trial , Open the baidu AI platform , find : Portrait animation this function , Then create your own application , Copy from the picture below 2 Just add a message to your own code . If you don't know Baidu AI Links to the platform , You can ask questions in the comment area ( No links in the article , It is easy to fail the audit ).
1 Lines of code implement complex functions , Is it convenient to use ?
The project has been included in 【 Open source in China 】、【Python Official website 】 Such as platform , All functions , Free for everyone to use : https://github.com/CoderWanFeng/python-office