{"id":18407565,"url":"https://github.com/clumsyme/qqai","last_synced_at":"2025-07-13T08:42:03.462Z","repository":{"id":57459074,"uuid":"145378764","full_name":"clumsyme/qqai","owner":"clumsyme","description":"简单易用的腾讯AI接口","archived":false,"fork":false,"pushed_at":"2019-02-22T01:51:31.000Z","size":29,"stargazers_count":63,"open_issues_count":0,"forks_count":15,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-03-15T10:12:57.687Z","etag":null,"topics":["ai","api","easy-to-use","python","qq","tencent"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clumsyme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-20T06:58:28.000Z","updated_at":"2023-10-27T02:43:18.000Z","dependencies_parsed_at":"2022-08-27T23:22:52.077Z","dependency_job_id":null,"html_url":"https://github.com/clumsyme/qqai","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clumsyme%2Fqqai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clumsyme%2Fqqai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clumsyme%2Fqqai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clumsyme%2Fqqai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clumsyme","download_url":"https://codeload.github.com/clumsyme/qqai/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247620624,"owners_count":20968247,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","api","easy-to-use","python","qq","tencent"],"created_at":"2024-11-06T03:14:29.827Z","updated_at":"2025-04-07T08:32:38.604Z","avatar_url":"https://github.com/clumsyme.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# qqai\n\n提供[腾讯AI](https://ai.qq.com/)简单易用的python接口。\n\n## 安装\n\n```bash\npip install qqai\n```\n\n## 目前完成的功能\n\n- [ ] 自然语言处理\n    - [x] 基础文本分析\n        - [x] 分词 (`qqai.nlp.text.WordSeg`)\n        - [x] 词性标注 (`qqai.nlp.text.WordPos`)\n        - [x] 专有名词识别 (`qqai.nlp.text.WordNer`)\n        - [x] 同义词识别 (`qqai.nlp.text.WordSyn`)\n    - [x] 语义解析\n        - [x] 意图成分识别 (`qqai.nlp.text.WordCom`)\n    - [x] 情感分析\n        - [x] 情感分析识别 (`qqai.nlp.text.TextPolar`)\n    - [x] 智能闲聊\n        - [x] 基础闲聊 (`qqai.nlp.text.TextChat`)\n    - [ ] 机器翻译\n        - [x] 文本翻译\n            - [x] 文本翻译（AI Lab） (`qqai.nlp.translate.TextTranslateAILab`)\n            - [x] 文本翻译（翻译君） (`qqai.nlp.translate.TextTranslateFanyi`)\n        - [x] 图片翻译 (`qqai.nlp.translate.ImageTranslate`)\n        - [ ] 语音翻译\n        - [x] 语种识别 (`qqai.nlp.translate.TextDetect`)\n- [ ] 智能语音\n    - [ ] 语音识别\n        - [x] 语音识别-echo版 (`qqai.aai.audio.AudioRecognitionEcho`)\n        - [ ] 语音识别-流式版（AI Lab）\n        - [ ] 语音识别-流式版(WeChat AI)\n    - [ ] 长语音识别\n    - [ ] 关键词检索\n    - [x] 语音合成\n        - [x] 语音合成（AI Lab） (`qqai.aai.tts.TTSAILab`)\n        - [x] 语音合成（优图） (`qqai.aai.tts.TTSYouTu`)\n- [x] 计算机视觉\n    - [x] 智能鉴黄 (`qqai.vision.picture.Porn`)\n    - [x] 暴恐识别 (`qqai.vision.picture.Terrorism`)\n    - [x] 优图OCR\n        - [x] 身份证OCR (`qqai.vision.ocr.IDCardOCR`)\n        - [x] 名片OCR (`qqai.vision.ocr.BCOCR`)\n        - [x] 行驶证驾驶证OCR (`qqai.vision.ocr.DriverLicenseOCR`)\n        - [x] 车牌OCR (`qqai.vision.ocr.PlateOCR`)\n        - [x] 营业执照OCR (`qqai.vision.ocr.BizLicenseOCR`)\n        - [x] 银行卡OCR (`qqai.vision.ocr.CreditCardOCR`)\n        - [x] 通用OCR (`qqai.vision.ocr.GeneralOCR`)\n        - [x] 手写体OCR (`qqai.vision.ocr.HandwritingOCR`)\n    - [x] 人脸识别\n        - [x] 人脸检测与分析 (`qqai.vision.face.DetectFace`)\n        - [x] 多人脸检测 (`qqai.vision.face.DetectMultiFace`)\n        - [x] 人脸对比 (`qqai.vision.face.FaceCompare`)\n        - [x] 跨年龄人脸识别 (`qqai.vision.face.DetectCrossAgeFace`)\n        - [x] 五官定位 (`qqai.vision.face.FaceShape`)\n        - [x] 人脸识别 (`qqai.vision.face.FaceIdentify`)\n        - [x] 人脸验证 (`qqai.vision.face.FaceVerify`)\n        - [x] 个体管理\n            - [x] 个体创建 (`qqai.vision.face.NewPerson`)\n            - [x] 删除个体 (`qqai.vision.face.DelPerson`)\n            - [x] 增加人脸 (`qqai.vision.face.AddFace`)\n            - [x] 删除人脸 (`qqai.vision.face.DelFace`)\n            - [x] 设置信息 (`qqai.vision.face.SetInfo`)\n            - [x] 获取信息 (`qqai.vision.face.GetInfo`)\n        - [x] 信息查询\n            - [x] 获取组列表 (`qqai.vision.face.GetGroupIds`)\n            - [x] 获取个体列表 (`qqai.vision.face.GetPersonIds`)\n            - [x] 获取人脸列表 (`qqai.vision.face.GetFaceIds`)\n            - [x] 获取人脸信息 (`qqai.vision.face.GetFaceInfo`)\n    - [x] 图片识别\n        - [x] 物体场景识别\n            - [x] 场景识别 (`qqai.vision.picture.SceneR`)\n            - [x] 物体识别 (`qqai.vision.picture.ObjectR`)\n        - [x] 图片标签识别 (`qqai.vision.picture.Tag`)\n        - [x] 看图说话 (`qqai.vision.picture.ImgToText`)\n        - [x] 模糊图片检测 (`qqai.vision.picture.Fuzzy`)\n        - [x] 美食图片识别 (`qqai.vision.picture.Food`)\n    - [x] 图片特效\n        - [x] 人脸美妆 (`qqai.vision.ptu.FaceCosmetic`)\n        - [x] 人脸变妆 (`qqai.vision.ptu.FaceDecoration`)\n        - [x] 滤镜\n            - [x] 滤镜（天天P图） (`qqai.vision.ptu.ImgFilterPitu`)\n            - [x] 滤镜（AI Lab） (`qqai.vision.ptu.ImgFilterAILab`)\n        - [x] 人脸融合 (`qqai.vision.ptu.FaceMerge`)\n        - [x] 大头贴 (`qqai.vision.ptu.FaceSticker`)\n        - [x] 颜龄检测 (`qqai.vision.ptu.FaceAge`)\n\n## 调用方式\n\n可以直接导入包，再使用其中的类；也可以导入子包或类。\n\n调用类的时候定义好AppID和AppKey。\n\n各个类都有一个`run()`方法以执行操作。该方法参数有所不同，请查阅开发平台文档和代码以输入。\n\n以下为示例：\n\n```python\nimport qqai\nqqai.vision.picture.ImgToText('your_app_id', 'your_app_key').run('https://yyb.gtimg.com/aiplat/ai/assets/ai-demo/express-6.jpg')\n# {'ret': 0, 'msg': 'ok', 'data': {'text': '一位男士在海边骑自行车的照片'}}\n\nfrom qqai.vision.picture import ImgToText\nit = ImgToText('your_app_id', 'your_app_key')\nit.run('https://yyb.gtimg.com/aiplat/ai/assets/ai-demo/express-6.jpg')\n# {'ret': 0, 'msg': 'ok', 'data': {'text': '一位男士在海边骑自行车的照片'}}\n\n# 图片类应用可接受图片文件作为输入\nwith open('cat.jpeg', 'rb') as file:\n    result = it.run(file)\n    print(result)\n# {'ret': 0, 'msg': 'ok', 'data': {'text': '一只白色的小猫'}}\n```\n\n## 更多示例\n\n- [聊天机器人](#聊天机器人)\n- [文本翻译](#文本翻译)\n- [图片转文字](#图片转文字)\n- [人脸检测](#人脸检测)\n\n### 聊天机器人\n\n```py\nfrom qqai import TextChat\n\nsiri = TextChat(your_app_id, your_app_key)\n\n# 单句对话\nanswer = siri.ask('你是谁')\nprint(answer)\n# \u003e\u003e\u003e 我是你的小助手啊\n\n# 连续聊天\nsiri.chat()\n# \u003c 有啥想跟我说的？\n# \u003e 你是谁啊？\n# \u003c 我是你的小助手啊\n# \u003e 你能干嘛呀\n# \u003c 呵呵，我能干的事情多的数不清。\n```\n\n### 文本翻译\n\n可用语言见[官方文档](https://ai.qq.com/doc/nlptrans.shtml#5-%E6%94%AF%E6%8C%81%E8%AF%AD%E8%A8%80%E5%AE%9A%E4%B9%89)\n\n```py\nfrom qqai import NLPTrans\n\nrobot = NLPTrans(you_app_id, you_app_key)\n\nresult = robot.run('愿原力与你同在')\nprint(result)\n# {'ret': 0, 'msg': 'ok', 'data': {'source_text': '愿原力与你同在', 'target_text': 'May the Force be with you'}}\n\n# 默认为中英翻译，若需要其他语种翻译，请按以下格式实例化：\n# source为源语言，target为目标语言，\nrobot = NLPTrans(you_app_id, you_app_key, source='en', target='es')\n\nresult = robot.run('May the force be with you.')\nprint(result)\n# {'ret': 0, 'msg': 'ok', 'data': {'source_text': 'May the force be with you.', 'target_text': 'Que la fuerza esté contigo.'}}\n```\n\n### 图片转文字\n\n```py\nfrom qqai import ImgToText\n\nrobot = ImgToText(your_app_id, your_app_key)\n\n# 识别图片URL\nresult = robot.run('https://yyb.gtimg.com/aiplat/ai/assets/ai-demo/express-6.jpg')\nprint(result)\n# {'ret': 0, 'msg': 'ok', 'data': {'text': '一位男士在海边骑自行车的照片'}}\n\n# 识别打开的本地图片\nwith open('/my/img.jpeg', 'rb') as image_file:\n    result = robot.run(image_file)\n    print(result)\n# {'ret': 0, 'msg': 'ok', 'data': {'text': '一艘飞船'}}\n```\n\n### 人脸检测\n\n```py\nfrom qqai import Detectface\n\nrobot = Detectface(your_app_id, your_app_key)\n\n# 调用方法与图片转文字相同\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclumsyme%2Fqqai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclumsyme%2Fqqai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclumsyme%2Fqqai/lists"}