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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -1,19 +1,25 @@
1
  import spacy
2
  import streamlit as st
 
3
  from sklearn.feature_extraction.text import TfidfVectorizer
4
  from sklearn.metrics.pairwise import cosine_similarity
5
  import PyPDF2
6
  import nltk
7
  from nltk.corpus import stopwords
8
  from nltk.tokenize import word_tokenize
9
- from gemini_flash import GeminiFlash # Assuming Gemini Flash is installed
10
 
11
  # Ensure that NLTK's stopwords are available
12
  nltk.download('punkt')
13
  nltk.download('stopwords')
14
 
15
- # Load spaCy model for NER
16
- nlp = spacy.load("en_core_web_sm")
 
 
 
 
 
17
 
18
  # Initialize Gemini Flash for prompt engineering
19
  prompt_engineer = GeminiFlash()
@@ -88,4 +94,3 @@ if resume_text and job_description:
88
  # For demonstration purposes, assume a function `get_llm_response` exists that interacts with a model.
89
  # response = get_llm_response(enhanced_prompt)
90
  # st.write("LLM Response:", response)
91
-
 
1
  import spacy
2
  import streamlit as st
3
+ import subprocess
4
  from sklearn.feature_extraction.text import TfidfVectorizer
5
  from sklearn.metrics.pairwise import cosine_similarity
6
  import PyPDF2
7
  import nltk
8
  from nltk.corpus import stopwords
9
  from nltk.tokenize import word_tokenize
10
+ from gemini_flash import GeminiFlash # Adjust if Gemini Flash is available
11
 
12
  # Ensure that NLTK's stopwords are 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()
 
94
  # For demonstration purposes, assume a function `get_llm_response` exists that interacts with a model.
95
  # response = get_llm_response(enhanced_prompt)
96
  # st.write("LLM Response:", response)