rasulbrur commited on
Commit
c29e353
·
1 Parent(s): cf5dce3

changed transformer version

Browse files
Files changed (2) hide show
  1. main.py +4 -4
  2. voice/classifier.py +1 -1
main.py CHANGED
@@ -2,8 +2,8 @@
2
  import asyncio
3
  import importlib
4
  from voice.speech_to_text import SpeechToText
5
- # from voice.intent_classifier import IntentClassifier
6
- from voice.classifier import TextClassifier
7
  from api.endpoints import FMPEndpoints
8
  from rag.retriever import Retriever
9
  from rag.sql_db import SQL_Key_Pair
@@ -12,8 +12,8 @@ from rag.web_search import duckduckgo_web_search
12
  async def process_query(vosk_model_path, audio_data=None, query_text=None, use_retriever=False):
13
  # Step 1: Initialize components
14
  stt = SpeechToText(model_path=vosk_model_path)
15
- # classifier = IntentClassifier()
16
- classifier = TextClassifier()
17
  endpoints = FMPEndpoints()
18
  # initialize rag tools
19
  retriever = Retriever(file_path="./data/financial_data.csv")
 
2
  import asyncio
3
  import importlib
4
  from voice.speech_to_text import SpeechToText
5
+ from voice.intent_classifier import IntentClassifier
6
+ # from voice.classifier import TextClassifier
7
  from api.endpoints import FMPEndpoints
8
  from rag.retriever import Retriever
9
  from rag.sql_db import SQL_Key_Pair
 
12
  async def process_query(vosk_model_path, audio_data=None, query_text=None, use_retriever=False):
13
  # Step 1: Initialize components
14
  stt = SpeechToText(model_path=vosk_model_path)
15
+ classifier = IntentClassifier()
16
+ # classifier = TextClassifier()
17
  endpoints = FMPEndpoints()
18
  # initialize rag tools
19
  retriever = Retriever(file_path="./data/financial_data.csv")
voice/classifier.py CHANGED
@@ -8,7 +8,7 @@ from difflib import SequenceMatcher
8
  class TextClassifier:
9
  def __init__(self):
10
  # Use a larger model for better NER (optional)
11
- self.nlp = spacy.load("en_core_web_sm") # "en_core_web_lg"
12
  try:
13
  # Use a smaller, PyTorch-compatible model for zero-shot classification
14
  self.classifier = pipeline("zero-shot-classification", model="typeform/distilbert-base-uncased-mnli")
 
8
  class TextClassifier:
9
  def __init__(self):
10
  # Use a larger model for better NER (optional)
11
+ self.nlp = spacy.load("en_core_web_lg") # "en_core_web_lg"
12
  try:
13
  # Use a smaller, PyTorch-compatible model for zero-shot classification
14
  self.classifier = pipeline("zero-shot-classification", model="typeform/distilbert-base-uncased-mnli")