Spaces:
Configuration error
Configuration error
aasherkamal216
commited on
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -1,6 +1,4 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import speech_recognition as sr
|
| 3 |
-
import tempfile
|
| 4 |
|
| 5 |
def about():
|
| 6 |
about_text = """This AI-powered Streamlit app allows users to interact with various LLMs through
|
|
@@ -32,18 +30,3 @@ def set_safety_settings():
|
|
| 32 |
]
|
| 33 |
|
| 34 |
return safety_settings
|
| 35 |
-
|
| 36 |
-
def speech_to_text(audio_bytes):
|
| 37 |
-
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as recording:
|
| 38 |
-
recording.write(audio_bytes)
|
| 39 |
-
temp_file_path = recording.name
|
| 40 |
-
|
| 41 |
-
r = sr.Recognizer()
|
| 42 |
-
with sr.AudioFile(temp_file_path) as source:
|
| 43 |
-
recorded_voice = r.record(source)
|
| 44 |
-
|
| 45 |
-
try:
|
| 46 |
-
text = r.recognize_google(recorded_voice, language="en")
|
| 47 |
-
return text
|
| 48 |
-
except:
|
| 49 |
-
return None
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
| 2 |
|
| 3 |
def about():
|
| 4 |
about_text = """This AI-powered Streamlit app allows users to interact with various LLMs through
|
|
|
|
| 30 |
]
|
| 31 |
|
| 32 |
return safety_settings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|