Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of Whisper ASR model #12

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Speech-to-Text.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import whisper
import time
import warnings
start = time.time()
warnings.filterwarnings('ignore',category=UserWarning)
decode_options={'language':'en'}
model = whisper.load_model(name='tiny.en',device='cuda')
transcription = model.transcribe(audio='D:/Users/mas/Downloads/audio.mp3',**decode_options)
print(transcription['text'])
end = time.time()

print("execution time: ",(end-start)*10**3," ms")
20 changes: 16 additions & 4 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
const express = require('express');
const http = require('http');
const https = require('https');
const fs = require('fs');
const socketIo = require('socket.io');
const path = require('path');

const app = express();
const server = http.createServer(app);

// Path to SSL certificate and key files
const options = {
key: fs.readFileSync('/home/ubuntu/LLMPoweredVirtualAgent-G78-PS24/key.pem'),
cert: fs.readFileSync('/home/ubuntu/LLMPoweredVirtualAgent-G78-PS24/cert.pem'),
};

const server = https.createServer(options, app);
const io = socketIo(server);

app.use(express.static('public'));

// To store the admin socket
let adminSocket = null;
const adminId = 'admin123'; // sample admin ID

Expand Down Expand Up @@ -58,6 +68,8 @@ io.on('connection', (socket) => {
});

const PORT = process.env.PORT || 3000;
server.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
const HOST = '0.0.0.0'; // Replace with your local IP address

server.listen(PORT, HOST, () => {
console.log(`Server is running on https://${HOST}:${PORT}`);
});