albhu commited on
Commit
eec0661
·
verified ·
1 Parent(s): 01da382

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -29,16 +29,19 @@ if document_file is not None:
29
  st.error("A dokumentum mérete túl nagy. Kérlek válassz egy kisebb méretű dokumentumot!")
30
  else:
31
  if document_file.type == "application/pdf":
 
32
  with pdfplumber.open(document_file) as pdf:
33
  document_text = ""
34
  for page in pdf.pages:
35
  document_text += page.extract_text()
36
  elif document_file.type == "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
 
37
  docx_file = docx.Document(document_file)
38
  document_text = ""
39
  for paragraph in docx_file.paragraphs:
40
  document_text += paragraph.text
41
  elif document_file.type == "application/msword":
 
42
  doc_file = docx.Document(document_file)
43
  document_text = ""
44
  for paragraph in doc_file.paragraphs:
 
29
  st.error("A dokumentum mérete túl nagy. Kérlek válassz egy kisebb méretű dokumentumot!")
30
  else:
31
  if document_file.type == "application/pdf":
32
+ # PDF fájl feldolgozása lapozás útján
33
  with pdfplumber.open(document_file) as pdf:
34
  document_text = ""
35
  for page in pdf.pages:
36
  document_text += page.extract_text()
37
  elif document_file.type == "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
38
+ # DOCX fájl feldolgozása részletekben
39
  docx_file = docx.Document(document_file)
40
  document_text = ""
41
  for paragraph in docx_file.paragraphs:
42
  document_text += paragraph.text
43
  elif document_file.type == "application/msword":
44
+ # DOC fájl feldolgozása részletekben
45
  doc_file = docx.Document(document_file)
46
  document_text = ""
47
  for paragraph in doc_file.paragraphs: