ValueError: [E985] Невозможно загрузить модель из файла конфигурации: раздел [nlp] не найден. {'nltk': {'stopwords': 'stopwords'}, 'spacy': {'model': 'en_core_web_sm'}
Я предоставил необходимый код ниже, который содержит основная часть, составляющая ошибку.
Код: Выделить всё
import streamlit as st
import nltk
import spacy
nltk.download('stopwords')
nlp = spacy.load('en_core_web_sm')
import pandas as pd
import base64, random
import time, datetime
from pyresparser import ResumeParser
from pdfminer3.layout import LAParams, LTTextBox
from pdfminer3.pdfpage import PDFPage
from pdfminer3.pdfinterp import PDFResourceManager
from pdfminer3.pdfinterp import PDFPageInterpreter
from pdfminer3.converter import TextConverter
import io, random
from streamlit_tags import st_tags
from PIL import Image
import pymysql
from Courses import ds_course, web_course, android_course, ios_course, uiux_course, resume_videos, interview_videos
import pafy
import plotly.express as px
def pdf_reader(file):
try:
resource_manager = PDFResourceManager()
fake_file_handle = io.StringIO()
converter = TextConverter(resource_manager, fake_file_handle, laparams=LAParams())
page_interpreter = PDFPageInterpreter(resource_manager, converter)
with open(file, 'rb') as fh:
for page in PDFPage.get_pages(fh, caching=True, check_extractable=True):
page_interpreter.process_page(page)
text = fake_file_handle.getvalue()
except Exception as e:
st.error(f"An error occurred while reading the PDF: {e}")
text = ""
finally:
converter.close()
fake_file_handle.close()
return text
def show_pdf(file_path):
with open(file_path, "rb") as f:
base64_pdf = base64.b64encode(f.read()).decode('utf-8')
# pdf_display = f''
pdf_display = F'
data:application/pdf;base64,{base64_pdf}
'
st.markdown(pdf_display, unsafe_allow_html=True)
st.set_page_config(
page_title="Resume Analyzer",
page_icon='./Logo/resumeAnalyserLogo.png',
)
def run():
st.title("Smart Resume Analyser")
st.sidebar.markdown("# Choose User")
activities = ["Normal User", "Admin"]
choice = st.sidebar.selectbox("Choose among the given options:", activities)
# link = '[©Developed by Spidy20](http://github.com/spidy20)'
# st.sidebar.markdown(link, unsafe_allow_html=True)
img = Image.open('./Logo/resumeAnalyserLogo.png')
if choice == 'Normal User':
# st.markdown('''[h4]* Upload your resume, and get smart recommendation based on it."[/h4]''',
# unsafe_allow_html=True)
pdf_file = st.file_uploader("Choose your Resume", type=["pdf"])
if pdf_file is not None:
# with st.spinner('Uploading your Resume....'):
# time.sleep(4)
save_image_path = './Uploaded_Resumes/' + pdf_file.name
with open(save_image_path, "wb") as f:
f.write(pdf_file.getbuffer())
show_pdf(save_image_path)
resume_data = ResumeParser(save_image_path).get_extracted_data()
if resume_data:
## Get the whole resume data
resume_text = pdf_reader(save_image_path)
st.header("**Resume Analysis**")
st.success("Hello " + resume_data['name'])
st.subheader("**Your Basic info**")
try:
st.text('Name: ' + resume_data['name'])
st.text('Email: ' + resume_data['email'])
st.text('Contact: ' + resume_data['mobile_number'])
st.text('Resume pages: ' + str(resume_data['no_of_pages']))
except:
pass
cand_level = ''
if resume_data['no_of_pages'] == 1:
cand_level = "Fresher"
st.markdown('''[h4]You are looking Fresher.[/h4]''',
unsafe_allow_html=True)
elif resume_data['no_of_pages'] == 2:
cand_level = "Intermediate"
st.markdown('''[h4]You are at intermediate level![/h4]''',
unsafe_allow_html=True)
elif resume_data['no_of_pages'] >= 3:
run()
Я пытался настроить config.cfg вручную
Я пытался внести некоторые изменения в резюме_parser.py изменив эту строку custom_nlp = spacy.load(os.path.dirname(os.path.abspath(__file__))) на custom_nlp = spacy.load('en_core_web_sm')
Подробнее здесь: https://stackoverflow.com/questions/788 ... lp-section