ckandemir commited on
Commit
2b6baf9
·
1 Parent(s): 7bfb35d

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +9 -0
handler.py CHANGED
@@ -1,3 +1,12 @@
 
 
 
 
 
 
 
 
 
1
  def __init__(self, path=""):
2
  # load the optimized model
3
  self.processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large")
 
1
+ from typing import Dict, List, Any
2
+ from PIL import Image
3
+ import torch
4
+ from io import BytesIO
5
+ from transformers import BlipForConditionalGeneration, BlipProcessor
6
+
7
+ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
8
+
9
+ class EndpointHandler():
10
  def __init__(self, path=""):
11
  # load the optimized model
12
  self.processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large")