AI
All the extension methods and attributes in the Ai Library depend on the AI extension package. Please import AI before use
import ai
Ai supports burning firmware 'mCookie' and 'mCookie extension'. In the text, the parameters that support the float type or the valid string float type are directly converted into int type in actual operation. For example, 2.3 is equivalent to 2, '2.6' is equivalent to 2
1、Image Identification
ai.cameraRead(modes,type)
"""
modes : On mode, the default is manual, the parameter is '-1', including '1' (after 1s), '2' (after 2s), '3' (after 3s), '-1' (manual)
type : Select the type to be recognized, the default is emoticon, the parameter is 'emotion', including 'emotion', 'gender', 'age', 'skin', 'glasses', 'beauty', 'carLicense', 'ocr'
Return value type : The return value is a string type
Function : By the camera, to identify 'emotion', 'gender', 'age', 'skin', 'glasses', 'beauty', 'carLicense', 'ocr'
Parameter Type : Modes, type only supports string types
"""
2、Identifying plants
ai.animalAndPlantRecognition(modes, type, num)
"""
modes : On mode, the default is manual, the parameter is '-1', including '1' (after 1s), '2' (after 2s), '3' (after 3s), '-1' (manual)
type : Select the type to be identified, the default is plant, the parameter is '0', contains '0' (plant) '1' (animal)
num : Select the object to be identified, the default is multiple, the parameter is '0', including '0' (multiple), '1' (first), '2' (second), '3' (third ), '4' (fourth), '5' (fifth)
Return value type : The return value is a string type
Function : Identifying animals and plants through the camera
Parameter type : modes, type, num only supports string types
"""
3、Voice input
ai.voiceInput(language, second)
"""
language : Select the language, the default is Chinese, the parameter is 'cn', contains 'cn' (Chinese), 'en' (English)
second : Language input duration, default is 2s, parameter is '2', including '2' (2s), '5' (5s), '10' (10s), '60' (60s)
Function : For voice input
Parameter type : language, second only supports string types
"""
4、Reading
ai.voiceOutput(gender,str(input_str))
"""
gender : Reading selected sound type, the default is female, parameter 2, comprising a (male), 2 (female)
input_str : The string to read, the default is empty
Function : Convert the input string to a language for reading
Parameter type : input_str only supports string types, 2 supports int, float, and pure numeric strings
"""
5、Translation
ai.translate(input_str,type)
"""
input_str : The string to be translated, the default is empty
type : The type to be translated, the default is English, the parameter is 'en', including 'zh' (Chinese), 'en' (English)
Function : Translate the input language string into the specified language
Return value type : Return value type is a string
Parameter type : input_str, type only supports string type
"""
6、Dialogue
ai.chat(input_str)
"""
input_str : Input content, default is empty, you can enter English or Chinese string
Function : Enter the enemy string and return the conversation content
Return value type : Return value type is a string
Parameter type : input_str only supports string types
"""