Voice_Commands / constants.py
zinoubm's picture
added final touches
4f8f8b7
raw
history blame
1.3 kB
from commands import ResponseManager
from dotenv import load_dotenv
from transformers import Speech2TextProcessor, Speech2TextForConditionalGeneration
import os
load_dotenv()
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
MODEL = os.getenv("MODEL")
rs = ResponseManager()
resoponses = {
"heated_seats_on": rs.activate_heated_seats,
"heated_seats_off": rs.deactivate_heated_seats,
"cooled_seats_on": rs.activate_cooled_seats,
"cooled_seats_off": rs.deactivate_cooled_seats,
"massage_seats_on": rs.activate_massage_seats,
"massage_seats_off": rs.deactivate_massage_seats,
}
id2label = {
1: "massage_seats_on",
2: "massage_seats_off",
3: "heated_seats_on",
4: "heated_seats_off",
5: "cooled_seats_on",
6: "cooled_seats_off",
}
text_respnses = {
"massage_seats_on": "Massage seats activated",
"massage_seats_off": "Massage seats deactivated",
"heated_seats_on": "Heated seats activated",
"heated_seats_off": "Heated seats deactivated",
"cooled_seats_on": "Cooled seats activated",
"cooled_seats_off": "Cooled seats deactivated",
}
model = Speech2TextForConditionalGeneration.from_pretrained(
"facebook/s2t-small-librispeech-asr"
)
processor = Speech2TextProcessor.from_pretrained("facebook/s2t-small-librispeech-asr")