File size: 768 Bytes
7c2f56b
 
23719bf
7c2f56b
23719bf
 
 
7c2f56b
23719bf
7c2f56b
23719bf
 
71c8e51
 
 
 
 
7c2f56b
71c8e51
 
7c2f56b
71c8e51
 
7c2f56b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from typing import Dict, List, Any
import faster_whisper
import torch

# Initialize the model and processor
model_name_or_path = "ivrit-ai/faster-whisper-v2-d3-e3"
device = "cuda" if torch.cuda.is_available() else "cpu"

model = faster_whisper.WhisperModel(model_name_or_path, device=device)

def predict(audio_file_path):
    return 'Bender is great!'
class CustomHandler:
    def __init__(self, model_name):
        self.tokenizer = AutoTokenizer.from_pretrained(model_name)
        self.model = AutoModelForSequenceClassification.from_pretrained(model_name)
        self.model.eval()  # Set the model to evaluation mode

    def __call__(self, data):
        return 'Bender is great!'

# Initialize the handler with your model
handler = CustomHandler(model_name)