Revert "Test pypi upload"

This commit is contained in:
makaveli
2024-02-08 12:23:15 +05:30
committed by GitHub
parent f98e309663
commit 6071cc1cc5
10 changed files with 46 additions and 325 deletions
+1 -6
View File
@@ -233,15 +233,10 @@ class Client:
print(element)
def on_error(self, ws, error):
print(f"[ERROR] WebSocket Error: {error}")
self.server_error = True
self.error_message = error
print(error)
def on_close(self, ws, close_status_code, close_msg):
print(f"[INFO]: Websocket connection closed: {close_status_code}: {close_msg}")
self.recording = False
self.server_error = False
self.waiting = False
def on_open(self, ws):
"""
+4 -1
View File
@@ -1,4 +1,5 @@
import os
import websockets
import time
import threading
import json
@@ -11,8 +12,10 @@ from websockets.sync.server import serve
import torch
import numpy as np
import queue
from whisper_live.vad import VoiceActivityDetection
from scipy.io.wavfile import write
import functools
from whisper_live.vad import VoiceActivityDetection
@@ -20,7 +23,7 @@ from whisper_live.transcriber import WhisperModel
try:
from whisper_live.transcriber_tensorrt import WhisperTRTLLM
except Exception as e:
pass
logging.warn("cannot import WhisperTRTLLM")
class TranscriptionServer:
+5
View File
@@ -10,7 +10,9 @@ import onnxruntime
class VoiceActivityDetection():
def __init__(self, force_onnx_cpu=True):
print("downloading ONNX model...")
path = self.download()
print("loading session")
opts = onnxruntime.SessionOptions()
opts.log_severity_level = 3
@@ -18,11 +20,13 @@ class VoiceActivityDetection():
opts.inter_op_num_threads = 1
opts.intra_op_num_threads = 1
print("loading onnx model")
if force_onnx_cpu and 'CPUExecutionProvider' in onnxruntime.get_available_providers():
self.session = onnxruntime.InferenceSession(path, providers=['CPUExecutionProvider'], sess_options=opts)
else:
self.session = onnxruntime.InferenceSession(path, providers=['CUDAExecutionProvider'], sess_options=opts)
print("reset states")
self.reset_states()
self.sample_rates = [8000, 16000]
@@ -106,6 +110,7 @@ class VoiceActivityDetection():
# Check if the model file already exists
if not os.path.exists(model_filename):
# If it doesn't exist, download the model using wget
print("Downloading VAD ONNX model...")
try:
subprocess.run(["wget", "-O", model_filename, model_url], check=True)
except subprocess.CalledProcessError: