Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
#
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|