DreamStream-1 commited on
Commit
523e3d6
·
verified ·
1 Parent(s): 1f609f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -9
app.py CHANGED
@@ -13,15 +13,21 @@ from gemini_flash import GeminiFlash # Adjust if Gemini Flash is available
13
  nltk.download('punkt')
14
  nltk.download('stopwords')
15
 
16
- # Check if the spaCy model is already installed, if not, install it
17
- try:
18
- nlp = spacy.load("en_core_web_sm")
19
- except OSError:
20
- # Install the model if it's not available
21
- subprocess.run(["python", "-m", "spacy", "download", "en_core_web_sm"], check=True)
22
- nlp = spacy.load("en_core_web_sm")
23
-
24
- # Initialize Gemini Flash for prompt engineering
 
 
 
 
 
 
25
  prompt_engineer = GeminiFlash()
26
 
27
  # Streamlit Interface
 
13
  nltk.download('punkt')
14
  nltk.download('stopwords')
15
 
16
+ # Function to install spaCy model
17
+ def download_spacy_model():
18
+ try:
19
+ # Attempt to load the model
20
+ nlp = spacy.load("en_core_web_sm")
21
+ except OSError:
22
+ # If not installed, download the model
23
+ subprocess.run(["python", "-m", "spacy", "download", "en_core_web_sm"], check=True)
24
+ nlp = spacy.load("en_core_web_sm")
25
+ return nlp
26
+
27
+ # Load spaCy model (ensure it is downloaded)
28
+ nlp = download_spacy_model()
29
+
30
+ # Initialize Gemini Flash for prompt engineering (if available)
31
  prompt_engineer = GeminiFlash()
32
 
33
  # Streamlit Interface