Spaces:
Running
Running
Commit
·
f078c1f
1
Parent(s):
4080a13
changed type to base64. not decode
Browse files
app.py
CHANGED
|
@@ -17,15 +17,14 @@ async def process_audio_stream(audio_path, max_tokens):
|
|
| 17 |
with open(audio_path, 'rb') as f:
|
| 18 |
audio_bytes = f.read()
|
| 19 |
base64_bytes = base64.b64encode(audio_bytes)
|
| 20 |
-
#
|
| 21 |
-
base64_string = base64_bytes.decode('utf-8')
|
| 22 |
|
| 23 |
-
print(
|
| 24 |
|
| 25 |
# Connect to WebSocket
|
| 26 |
async with websockets.connect('ws://nexa-omni.nexa4ai.com/ws/process-audio/') as websocket:
|
| 27 |
-
# Send binary base64 audio data
|
| 28 |
-
await websocket.send(
|
| 29 |
|
| 30 |
# Send parameters as JSON string
|
| 31 |
await websocket.send(json.dumps({
|
|
|
|
| 17 |
with open(audio_path, 'rb') as f:
|
| 18 |
audio_bytes = f.read()
|
| 19 |
base64_bytes = base64.b64encode(audio_bytes)
|
| 20 |
+
# Keep as bytes - don't decode to string
|
|
|
|
| 21 |
|
| 22 |
+
print(base64_bytes) # For debugging
|
| 23 |
|
| 24 |
# Connect to WebSocket
|
| 25 |
async with websockets.connect('ws://nexa-omni.nexa4ai.com/ws/process-audio/') as websocket:
|
| 26 |
+
# Send binary base64 audio data as bytes
|
| 27 |
+
await websocket.send(base64_bytes) # Send the raw base64 bytes
|
| 28 |
|
| 29 |
# Send parameters as JSON string
|
| 30 |
await websocket.send(json.dumps({
|