Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -143,12 +143,16 @@ def bot(history, choice):
|
|
143 |
response, addresses = generate_answer(history[-1][0], choice)
|
144 |
history[-1][1] = ""
|
145 |
|
146 |
-
# Generate audio for the entire response
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
|
|
|
|
|
|
|
|
152 |
yield history, audio_path
|
153 |
|
154 |
|
@@ -429,7 +433,7 @@ def get_weather_icon(condition):
|
|
429 |
"Thunderstorm": "t01d",
|
430 |
"Fog": "a05d",
|
431 |
}
|
432 |
-
return condition_map.get(condition, "
|
433 |
|
434 |
# Voice Control
|
435 |
import numpy as np
|
|
|
143 |
response, addresses = generate_answer(history[-1][0], choice)
|
144 |
history[-1][1] = ""
|
145 |
|
146 |
+
# Generate audio for the entire response in a separate thread
|
147 |
+
with concurrent.futures.ThreadPoolExecutor() as executor:
|
148 |
+
audio_future = executor.submit(generate_audio_elevenlabs, response)
|
149 |
+
|
150 |
+
for character in response:
|
151 |
+
history[-1][1] += character
|
152 |
+
time.sleep(0.05) # Adjust the speed of text appearance
|
153 |
+
yield history, None
|
154 |
+
|
155 |
+
audio_path = audio_future.result()
|
156 |
yield history, audio_path
|
157 |
|
158 |
|
|
|
433 |
"Thunderstorm": "t01d",
|
434 |
"Fog": "a05d",
|
435 |
}
|
436 |
+
return condition_map.get(condition, "c04d")
|
437 |
|
438 |
# Voice Control
|
439 |
import numpy as np
|