Update app.py
Browse files
app.py
CHANGED
@@ -8,8 +8,6 @@ import PIL.Image
|
|
8 |
import mss
|
9 |
from google import genai
|
10 |
from google.genai import types
|
11 |
-
from pydub import AudioSegment
|
12 |
-
from pydub.playback import play
|
13 |
import soundfile as sf
|
14 |
|
15 |
# Configuration
|
@@ -78,12 +76,9 @@ class GeminiTTS:
|
|
78 |
turn = session.receive()
|
79 |
async for response in turn:
|
80 |
if data := response.data:
|
81 |
-
# Convert to
|
82 |
audio_array = np.frombuffer(data, dtype=np.float32)
|
83 |
-
|
84 |
-
sf.write(wav_buffer, audio_array, SAMPLE_RATE, format='WAV')
|
85 |
-
wav_bytes = wav_buffer.getvalue()
|
86 |
-
return (SAMPLE_RATE, wav_bytes)
|
87 |
if text := response.text:
|
88 |
return text
|
89 |
|
|
|
8 |
import mss
|
9 |
from google import genai
|
10 |
from google.genai import types
|
|
|
|
|
11 |
import soundfile as sf
|
12 |
|
13 |
# Configuration
|
|
|
76 |
turn = session.receive()
|
77 |
async for response in turn:
|
78 |
if data := response.data:
|
79 |
+
# Convert to numpy array for Gradio Audio component
|
80 |
audio_array = np.frombuffer(data, dtype=np.float32)
|
81 |
+
return (SAMPLE_RATE, audio_array)
|
|
|
|
|
|
|
82 |
if text := response.text:
|
83 |
return text
|
84 |
|