Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,7 +46,7 @@ with footer_container:
|
|
| 46 |
# for message in st.session_state.messages:
|
| 47 |
# with st.chat_message(message["role"]):
|
| 48 |
# st.write(message["content"])
|
| 49 |
-
path = "
|
| 50 |
with open(path, "r") as file:
|
| 51 |
url = json.load(file)
|
| 52 |
st_lottie(
|
|
@@ -60,7 +60,7 @@ st_lottie(
|
|
| 60 |
key='Car'
|
| 61 |
)
|
| 62 |
st.write(f'<div style="text-align: right;">π€:Hi am Neo from Newton School How can i Help you today!</div>', unsafe_allow_html=True)
|
| 63 |
-
autoplay_audio_right("
|
| 64 |
with sr.Microphone() as source:
|
| 65 |
while True:
|
| 66 |
# recognizer.energy_threshold = 4000
|
|
@@ -75,7 +75,7 @@ with sr.Microphone() as source:
|
|
| 75 |
# recognizer.adjust_for_ambient_noise(source)
|
| 76 |
transcript = recognizer.recognize_whisper_api(audio_bytes, model="whisper-1", api_key=OPEN_AI_API_KEY)
|
| 77 |
st.write(f'<div style="text-align: left;">π€:{transcript}</div>', unsafe_allow_html=True)
|
| 78 |
-
fastapi_url = '
|
| 79 |
modified_transcript = PRE_CONTEXT + f"""USER_CODE:{code_editor}""" + f"""My Query : {transcript}"""
|
| 80 |
payload = {
|
| 81 |
"transcribed_text": modified_transcript
|
|
@@ -96,7 +96,7 @@ with sr.Microphone() as source:
|
|
| 96 |
recognizer.adjust_for_ambient_noise(source)
|
| 97 |
transcript = recognizer.recognize_whisper_api(audio_bytes, api_key=OPEN_AI_API_KEY)
|
| 98 |
st.write(f'<div style="text-align: left;">π€:{transcript}</div>', unsafe_allow_html=True)
|
| 99 |
-
fastapi_url = '
|
| 100 |
modified_transcript = PRE_CONTEXT + f"""My Query : {transcript}"""
|
| 101 |
payload = {
|
| 102 |
"transcribed_text": modified_transcript
|
|
@@ -113,7 +113,7 @@ with sr.Microphone() as source:
|
|
| 113 |
# time.sleep(20)
|
| 114 |
break
|
| 115 |
else:
|
| 116 |
-
audio_path = "
|
| 117 |
autoplay_audio_right(audio_path)
|
| 118 |
st.write('<div style="text-align: right;">π€:Hey please tell something I will help you</div>', unsafe_allow_html=True)
|
| 119 |
# time.sleep(20)
|
|
|
|
| 46 |
# for message in st.session_state.messages:
|
| 47 |
# with st.chat_message(message["role"]):
|
| 48 |
# st.write(message["content"])
|
| 49 |
+
path = "Animation 1706769103946.json"
|
| 50 |
with open(path, "r") as file:
|
| 51 |
url = json.load(file)
|
| 52 |
st_lottie(
|
|
|
|
| 60 |
key='Car'
|
| 61 |
)
|
| 62 |
st.write(f'<div style="text-align: right;">π€:Hi am Neo from Newton School How can i Help you today!</div>', unsafe_allow_html=True)
|
| 63 |
+
autoplay_audio_right("greetings.mp3")
|
| 64 |
with sr.Microphone() as source:
|
| 65 |
while True:
|
| 66 |
# recognizer.energy_threshold = 4000
|
|
|
|
| 75 |
# recognizer.adjust_for_ambient_noise(source)
|
| 76 |
transcript = recognizer.recognize_whisper_api(audio_bytes, model="whisper-1", api_key=OPEN_AI_API_KEY)
|
| 77 |
st.write(f'<div style="text-align: left;">π€:{transcript}</div>', unsafe_allow_html=True)
|
| 78 |
+
fastapi_url = 'https://fast-api-voice-app.onrender.com/audio_generation_for_code'
|
| 79 |
modified_transcript = PRE_CONTEXT + f"""USER_CODE:{code_editor}""" + f"""My Query : {transcript}"""
|
| 80 |
payload = {
|
| 81 |
"transcribed_text": modified_transcript
|
|
|
|
| 96 |
recognizer.adjust_for_ambient_noise(source)
|
| 97 |
transcript = recognizer.recognize_whisper_api(audio_bytes, api_key=OPEN_AI_API_KEY)
|
| 98 |
st.write(f'<div style="text-align: left;">π€:{transcript}</div>', unsafe_allow_html=True)
|
| 99 |
+
fastapi_url = 'https://fast-api-voice-app.onrender.com/audio_generation'
|
| 100 |
modified_transcript = PRE_CONTEXT + f"""My Query : {transcript}"""
|
| 101 |
payload = {
|
| 102 |
"transcribed_text": modified_transcript
|
|
|
|
| 113 |
# time.sleep(20)
|
| 114 |
break
|
| 115 |
else:
|
| 116 |
+
audio_path = "listen.mp3"
|
| 117 |
autoplay_audio_right(audio_path)
|
| 118 |
st.write('<div style="text-align: right;">π€:Hey please tell something I will help you</div>', unsafe_allow_html=True)
|
| 119 |
# time.sleep(20)
|