TGViewer
Big Data AI Big Data AI @bigdatai · 18.2K subscribers
Post #353 3.04K
🎤🔤 Embrace the Power of Speech-to-Text in Python!

Пошаговый пример кода на языке Python, использующий библиотеку SpeechRecognition для преобразования речи в текст.

pip install SpeechRecognition

import speech_recognition as sr

recognizer = sr.Recognizer()


with sr.Microphone() as source:
print("Say something...")
recognizer.adjust_for_ambient_noise(source) # Optional: Adjust for background noise
audio = recognizer.listen(source)


audio_file = "path/to/your/audio_file.wav" # Replace with the path to your audio file
with sr.AudioFile(audio_file) as source:
audio = recognizer.listen(source)


try:
print("Converting speech to text...")
text = recognizer.recognize_google(audio)
print("You said:", text)
except sr.UnknownValueError:
print("Google Speech Recognition could not understand the audio.")
except sr.RequestError as e:
print("Could not request results from Google Speech Recognition service; {0}".format(e))


@bigdatai
  • 👍 6
  • ❤ 2
  • 🔥 2
More from @bigdatai
  1. Oct 16, 2026🧪 Sakana AI собрала команду ИИ-агентов для научных исследований The Agentic Scientist объ…
  2. Oct 16, 2026Компании выросли из вайбкодинга — куда двигаемся дальше? Год назад вайбкодинг обсуждали на…
  3. Oct 15, 2026По данным FT, Netflix сократит примерно 6% глобального штата,крупнейшие увольнения с 2022…
  4. Oct 13, 2026photo post
  5. Oct 13, 2026🧠 В 22 года объяснить Гильберту его же математику Давид Гильберт, один из величайших мате…
  6. Oct 12, 2026Z.ai выпустила GLM-Legal, отдельную модель для юристов Z.ai представила GLM-Legal, юридиче…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →