bravewiki commited on
Commit
da75885
·
verified ·
1 Parent(s): b1f8173

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,15 +1,16 @@
1
  import streamlit as st
2
- from transformers import pipeline
3
  import pytesseract
4
  import cv2
5
  import numpy as np
6
  from PIL import Image
7
  from huggingface_hub import login
8
 
9
- login()
10
 
11
  # Load the model
12
- model = pipeline("text2text-generation", model="google/paligemma-3b-mix-224")
 
13
 
14
  # Function to extract text from image using OCR
15
  def extract_text_from_image(image_file):
 
1
  import streamlit as st
2
+ from transformers import AutoProcessor, AutoModelForPreTraining
3
  import pytesseract
4
  import cv2
5
  import numpy as np
6
  from PIL import Image
7
  from huggingface_hub import login
8
 
9
+ login(HF_token)
10
 
11
  # Load the model
12
+ processor = AutoProcessor.from_pretrained("google/paligemma-3b-mix-224")
13
+ model = AutoModelForPreTraining.from_pretrained("google/paligemma-3b-mix-224")
14
 
15
  # Function to extract text from image using OCR
16
  def extract_text_from_image(image_file):