{"id":205103,"date":"2025-05-29T09:59:41","date_gmt":"2025-05-29T01:59:41","guid":{"rendered":"https:\/\/server.hk\/cnblog\/205103\/"},"modified":"2025-05-29T09:59:41","modified_gmt":"2025-05-29T01:59:41","slug":"whisper-%e5%ae%89%e8%a3%85%e5%9b%b0%e9%9a%be%ef%bc%9fpython-%e8%af%ad%e9%9f%b3%e8%af%86%e5%88%ab%e5%ba%93%e6%9c%89%e5%93%aa%e4%ba%9b%e5%85%b6%e4%bb%96%e9%80%89%e6%8b%a9%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/205103\/","title":{"rendered":"Whisper \u5b89\u88c5\u56f0\u96be\uff1fPython \u8bed\u97f3\u8bc6\u522b\u5e93\u6709\u54ea\u4e9b\u5176\u4ed6\u9009\u62e9\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Whisper \u5b89\u88c5\u56f0\u96be\uff1fPython \u8bed\u97f3\u8bc6\u522b\u5e93\u6709\u54ea\u4e9b\u5176\u4ed6\u9009\u62e9\uff1f<\/h1>\n<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241123\/17323637986741c616cbef9.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>python \u8bed\u97f3\u8bc6\u522b\u5e93\u7684\u63a8\u8350<\/strong><\/p>\n<p>\u5bf9\u4e8e\u9700\u8981\u5b9e\u73b0\u8bed\u97f3\u8f6c\u6587\u5b57\u529f\u80fd\u7684\u7528\u6237\uff0c\u5728\u7ecf\u5386\u4e86 whisper \u5e93\u7684\u5b89\u88c5\u56f0\u5883\u548c\u8fd0\u884c\u5361\u987f\u540e\uff0c\u4e0d\u59a8\u8003\u8651\u5176\u4ed6\u53ef\u9009\u7684\u8bed\u97f3\u8bc6\u522b\u5e93\u3002<\/p>\n<p><strong>speechrecognition \u5e93<\/strong><\/p>\n<p>speechrecognition \u5e93\u63d0\u4f9b\u4e86\u5bf9\u591a\u79cd\u8bed\u97f3\u8bc6\u522b api \u7684\u652f\u6301\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>google web speech api<\/li>\n<li>microsoft bing voice recognition<\/li>\n<li>ibm speech to text<\/li>\n<\/ul>\n<p>\u8be5\u5e93\u4f7f\u7528\u7b80\u5355\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u96c6\u6210\u5230 python \u9879\u76ee\u4e2d\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528 speechrecognition \u5e93\u8fdb\u884c\u8bed\u97f3\u8f6c\u6587\u5b57\u7684\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n<pre>import speech_recognition as sr\n\nr = sr.Recognizer()\nwith sr.Microphone() as source:\n    # \u4ece\u9ea6\u514b\u98ce\u83b7\u53d6\u97f3\u9891\u8f93\u5165\n    audio = r.listen(source)\n\ntry:\n    # \u4f7f\u7528 Google Web Speech API \u8bc6\u522b\u97f3\u9891\n    text = r.recognize_google(audio)\n    print(\"\u8bc6\u522b\u7ed3\u679c\uff1a\", text)\nexcept sr.RequestError:\n    print(\"\u4e0e Speech Recognition \u670d\u52a1\u901a\u4fe1\u65f6\u51fa\u73b0\u9519\u8bef\u3002\")\nexcept sr.UnknownValueError:\n    print(\"\u65e0\u6cd5\u8bc6\u522b\u8bed\u97f3\u3002\")<\/pre>\n<p>speechrecognition \u5e93\u6613\u4e8e\u4f7f\u7528\u3001\u652f\u6301\u591a\u79cd api\uff0c\u662f\u4e00\u4e2a\u9002\u5408\u8bed\u97f3\u8f6c\u6587\u5b57\u4efb\u52a1\u7684\u5f3a\u5927\u9009\u62e9\u3002<\/p>\n<p>\u672c\u7bc7\u5173\u4e8e\u300aWhisper \u5b89\u88c5\u56f0\u96be\uff1fPython \u8bed\u97f3\u8bc6\u522b\u5e93\u6709\u54ea\u4e9b\u5176\u4ed6\u9009\u62e9\uff1f\u300b\u7684\u4ecb\u7ecd\u5c31\u5230\u6b64\u7ed3\u675f\u5566\uff0c\u4f46\u662f\u5b66\u65e0\u6b62\u5883\uff0c\u60f3\u8981\u4e86\u89e3\u5b66\u4e60\u66f4\u591a\u5173\u4e8e\u6587\u7ae0\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u8bf7\u5173\u6ce8\u516c\u4f17\u53f7\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Whisper \u5b89\u88c5\u56f0\u96be\uff1fPyt&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-205103","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/205103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=205103"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/205103\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=205103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=205103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=205103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}