bhagyabonam commited on
Commit
a9d6e73
·
verified ·
1 Parent(s): 1802bfb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -39,7 +39,7 @@ class CustomEmbeddingFunction:
39
 
40
  # Initialize components
41
  sentiment_pipeline = pipeline("sentiment-analysis")
42
- chroma_client = Client(Settings(persist_directory="chromadb_storage"))
43
  embedding_fn = CustomEmbeddingFunction()
44
  collection_name = "crm_data"
45
 
@@ -84,11 +84,9 @@ def update_google_sheet(transcribed_text, sentiment,objection, recommendations,o
84
 
85
  load_dotenv()
86
  huggingface_api_key= os.getenv("HUGGINGFACE_TOKEN")
87
- if huggingface_api_key:
88
- login(token=huggingface_api_key)
89
- else:
90
- raise ValueError("Hugging Face API key not found. Please set the HUGGINGFACE_TOKEN environment variable.")
91
-
92
  model_name = "tabularisai/multilingual-sentiment-analysis"
93
  model = AutoModelForSequenceClassification.from_pretrained(model_name)
94
  tokenizer = AutoTokenizer.from_pretrained(model_name)
 
39
 
40
  # Initialize components
41
  sentiment_pipeline = pipeline("sentiment-analysis")
42
+ chroma_client = Client(Settings(persist_directory="chromadb_storage",chroma_db_impl="duckdb+parquet"))
43
  embedding_fn = CustomEmbeddingFunction()
44
  collection_name = "crm_data"
45
 
 
84
 
85
  load_dotenv()
86
  huggingface_api_key= os.getenv("HUGGINGFACE_TOKEN")
87
+ if not huggingface_api_key:
88
+ st.error("Hugging Face API key not found. Please set the HUGGINGFACE_TOKEN environment variable.")
89
+ st.stop()
 
 
90
  model_name = "tabularisai/multilingual-sentiment-analysis"
91
  model = AutoModelForSequenceClassification.from_pretrained(model_name)
92
  tokenizer = AutoTokenizer.from_pretrained(model_name)