dedlepexa commited on
Commit
03c041d
·
verified ·
1 Parent(s): e6d49a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -20
app.py CHANGED
@@ -202,34 +202,27 @@ async def upload_audio(
202
  )
203
 
204
  # -------------------------------------
205
- # SpeechRecognition
206
- # -------------------------------------
207
-
208
- recognizer = sr.Recognizer()
209
 
210
- try:
211
 
212
- with sr.AudioFile(wav_path) as source:
213
 
214
- audio_data =
215
- recognizer.record(source)
216
 
217
- text =
218
- recognizer.recognize_google(
219
- audio_data,
220
- language="ru-RU"
221
- )
222
 
223
- LAST_TEXT = text
 
 
 
224
 
225
- except Exception as e:
226
 
227
- text = str(e)
228
 
229
- return {
230
- "status":"ok",
231
- "text":text
232
- }
233
 
234
  # =========================================
235
  # Получить последний текст
 
202
  )
203
 
204
  # -------------------------------------
205
+ # SpeechRecognition
206
+ # -------------------------------------
 
 
207
 
208
+ recognizer = sr.Recognizer()
209
 
210
+ try:
211
 
212
+ with sr.AudioFile(wav_path) as source:
 
213
 
214
+ audio_data = recognizer.record(source)
 
 
 
 
215
 
216
+ text = recognizer.recognize_google(
217
+ audio_data,
218
+ language="ru-RU"
219
+ )
220
 
221
+ LAST_TEXT = text
222
 
223
+ except Exception as e:
224
 
225
+ text = str(e)
 
 
 
226
 
227
  # =========================================
228
  # Получить последний текст