Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Akshat2512 committed Nov 28, 2024
1 parent 0413cde commit e90ca98
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 4 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from backend.speech_proccessing import process_audio_stream
from backend.openai_models import transcribe_audio, generate_response, generate_image_response, ChatHistory

import pytz
import time, wave
import asyncio
import json
Expand Down Expand Up @@ -89,7 +90,9 @@ async def handle_audio_new(websocket: WebSocket, audio_queue):

try:
audio_data = await websocket.receive_bytes() # receives the audio stream from clients
kolkata_time = datetime.now() # Print the current time

kolkata_tz = pytz.timezone('Asia/Kolkata')
kolkata_time = datetime.now(kolkata_tz) # Print the current time
await websocket.send_json({"Recieved":kolkata_time.strftime('%Y-%m-%d %H:%M:%S')})

with wave.open(io.BytesIO(audio_data), 'rb') as wav_file:
Expand Down
4 changes: 2 additions & 2 deletions backend/speech_proccessing.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

# import wave
import numpy as np
# import tensorflow.lite as tflite
import tensorflow.lite as tflite
import zipfile
import time
import tflite_runtime.interpreter as tflite
# import tflite_runtime.interpreter as tflite

import logging

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ tflite-runtime == 2.7.0
# tensorflow-cpu == 2.18.0
uvicorn[standard] == 0.32.0
jinja2 == 3.1.4
pytz

4 changes: 2 additions & 2 deletions static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function start_recording() {
numberOfAudioChannels: 1,
desiredSampRate: 16000,
bufferSize: 1024,
timeSlice: 1000,
timeSlice: 3000,
ondataavailable: function(Blob) {
const reader = new FileReader();
reader.onloadend = async function() {
Expand Down Expand Up @@ -106,7 +106,7 @@ function stopRecording(){
async function connect_ws(user_id){

return new Promise((resolve, reject) => {
const socket = new WebSocket(`wss://${window.location.hostname}:${window.location.port}/ws/`+user_id);
const socket = new WebSocket(`ws://${window.location.hostname}:${window.location.port}/ws/`+user_id);
socket.onopen = function(event) {
resolve(socket)
};
Expand Down

0 comments on commit e90ca98

Please sign in to comment.