Workpam commited on
Commit
66e4ab8
·
verified ·
1 Parent(s): 3638193

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -8,15 +8,19 @@ import easyocr
8
  device = "cuda" if torch.cuda.is_available() else "cpu"
9
  model_name = "Salesforce/blip2-flan-t5-xl"
10
 
11
- processor = Blip2Processor.from_pretrained(model_name, use_fast=False)
12
- model = (
13
- Blip2ForConditionalGeneration.from_pretrained(
14
- model_name,
15
- torch_dtype=torch.float16 if device == "cuda" else torch.float32
16
- )
17
- .to(device)
18
  )
19
 
 
 
 
 
 
 
 
20
  ocr_reader = easyocr.Reader(['en'], gpu=(device == "cuda"))
21
  detector = pipeline(
22
  "object-detection",
 
8
  device = "cuda" if torch.cuda.is_available() else "cpu"
9
  model_name = "Salesforce/blip2-flan-t5-xl"
10
 
11
+ processor = Blip2Processor.from_pretrained(
12
+ model_name,
13
+ use_fast=False,
14
+ trust_remote_code=True
 
 
 
15
  )
16
 
17
+ model = Blip2ForConditionalGeneration.from_pretrained(
18
+ model_name,
19
+ torch_dtype=(torch.float16 if device=="cuda" else torch.float32),
20
+ trust_remote_code=True
21
+ ).to(device)
22
+
23
+
24
  ocr_reader = easyocr.Reader(['en'], gpu=(device == "cuda"))
25
  detector = pipeline(
26
  "object-detection",