rohitashva commited on
Commit
f406f79
·
verified ·
1 Parent(s): 1d66003

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -4,6 +4,20 @@ from transformers import AutoModel, AutoTokenizer
4
  from pdf2image import convert_from_path
5
  import torch
6
  import os
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  # Load the OCR model
9
  tokenizer = AutoTokenizer.from_pretrained("ucaslcl/GOT-OCR2_0", trust_remote_code=True)
 
4
  from pdf2image import convert_from_path
5
  import torch
6
  import os
7
+ import os
8
+ import subprocess
9
+ import streamlit as st
10
+ import google.generativeai as genai
11
+ from transformers import AutoModel, AutoTokenizer
12
+ from pdf2image import convert_from_path
13
+ import torch
14
+
15
+ # Ensure Poppler is installed
16
+ def install_poppler():
17
+ if not os.path.exists("/usr/bin/pdftoppm"): # Check if Poppler is installed
18
+ st.warning("Installing Poppler for PDF processing...")
19
+ subprocess.run(["apt-get", "update"])
20
+ subprocess.run(["apt-get", "install", "-y", "poppler-utils"])
21
 
22
  # Load the OCR model
23
  tokenizer = AutoTokenizer.from_pretrained("ucaslcl/GOT-OCR2_0", trust_remote_code=True)