Reshmarb commited on
Commit
b9f6329
·
1 Parent(s): 17593c4

project added

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -37,7 +37,19 @@ client = Groq(api_key=os.getenv("GROQ_API_KEY_2"))
37
  #client = Groq(api_key="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")
38
 
39
  # Initialize spaCy NLP model for named entity recognition (NER)
40
- nlp = spacy.load("en_core_web_sm")
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
  # Initialize sentiment analysis model using Hugging Face
43
  sentiment_analyzer = pipeline("sentiment-analysis")
 
37
  #client = Groq(api_key="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")
38
 
39
  # Initialize spaCy NLP model for named entity recognition (NER)
40
+ import spacy
41
+
42
+ # Download the model if it's not already installed
43
+ try:
44
+ nlp = spacy.load("en_core_web_sm")
45
+ except OSError:
46
+ print("Downloading 'en_core_web_sm' model...")
47
+ import os
48
+ os.system("python -m spacy download en_core_web_sm")
49
+ nlp = spacy.load("en_core_web_sm")
50
+
51
+ # Your code continues here
52
+ print("Model loaded successfully!")
53
 
54
  # Initialize sentiment analysis model using Hugging Face
55
  sentiment_analyzer = pipeline("sentiment-analysis")