Parthiban97 commited on
Commit
80e13dd
·
verified ·
1 Parent(s): 7e31859

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -1,7 +1,6 @@
1
  ## Importing Libraries
2
  import streamlit as st
3
  import os
4
- import docx
5
  from PyPDF2 import PdfReader
6
  import google.generativeai as genai
7
  from dotenv import load_dotenv
@@ -24,11 +23,12 @@ def get_pdf_text(pdf_docs):
24
  text += page.extract_text()
25
  elif doc.name.endswith(".docx"):
26
  try:
 
27
  doc_reader = docx.Document(doc)
28
  for para in doc_reader.paragraphs:
29
  text += para.text + "\n"
30
  except ImportError:
31
- pass
32
  return text
33
 
34
  # Define input prompts
@@ -84,6 +84,8 @@ with st.sidebar:
84
  uploaded_files = st.file_uploader("Upload Your Resume in .PDF or .DOCX format 📂", type=["pdf", "docx"], accept_multiple_files=True)
85
  if uploaded_files is None:
86
  st.error("Please upload a PDF or DOCX file to proceed.")
 
 
87
 
88
  # Set the API key for genai
89
  if api_key:
 
1
  ## Importing Libraries
2
  import streamlit as st
3
  import os
 
4
  from PyPDF2 import PdfReader
5
  import google.generativeai as genai
6
  from dotenv import load_dotenv
 
23
  text += page.extract_text()
24
  elif doc.name.endswith(".docx"):
25
  try:
26
+ import docx
27
  doc_reader = docx.Document(doc)
28
  for para in doc_reader.paragraphs:
29
  text += para.text + "\n"
30
  except ImportError:
31
+ st.error("Please make sure you have installed the `python-docx` package.")
32
  return text
33
 
34
  # Define input prompts
 
84
  uploaded_files = st.file_uploader("Upload Your Resume in .PDF or .DOCX format 📂", type=["pdf", "docx"], accept_multiple_files=True)
85
  if uploaded_files is None:
86
  st.error("Please upload a PDF or DOCX file to proceed.")
87
+ else:
88
+ st.success("Files Uploaded Successfully.")
89
 
90
  # Set the API key for genai
91
  if api_key: