Snowad commited on
Commit
007587c
1 Parent(s): 1f6e2f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -12,7 +12,6 @@ model = VisionEncoderDecoderModel.from_pretrained("kha-white/manga-ocr-base")
12
  model.to("cuda")
13
 
14
  feature_extractor = AutoFeatureExtractor.from_pretrained("kha-white/manga-ocr-base")
15
- feature_extractor.to("cuda")
16
 
17
  examples = ["00.jpg", "01.jpg", "02.jpg", "03.jpg", "04.jpg", "05.jpg", "06.jpg", "07.jpg", "08.jpg", "09.jpg", "10.jpg", "11.jpg"]
18
 
@@ -26,7 +25,7 @@ def post_process(text):
26
  @spaces.GPU
27
  def manga_ocr(img):
28
  img = img.convert('L').convert('RGB')
29
- pixel_values = feature_extractor(img, return_tensors="pt").pixel_values
30
  output = model.generate(pixel_values)[0]
31
  text = tokenizer.decode(output, skip_special_tokens=True)
32
  text = post_process(text)
 
12
  model.to("cuda")
13
 
14
  feature_extractor = AutoFeatureExtractor.from_pretrained("kha-white/manga-ocr-base")
 
15
 
16
  examples = ["00.jpg", "01.jpg", "02.jpg", "03.jpg", "04.jpg", "05.jpg", "06.jpg", "07.jpg", "08.jpg", "09.jpg", "10.jpg", "11.jpg"]
17
 
 
25
  @spaces.GPU
26
  def manga_ocr(img):
27
  img = img.convert('L').convert('RGB')
28
+ pixel_values = feature_extractor(img, return_tensors="pt").pixel_values.to("cuda")
29
  output = model.generate(pixel_values)[0]
30
  text = tokenizer.decode(output, skip_special_tokens=True)
31
  text = post_process(text)