Norm commited on
Commit
f36f15b
1 Parent(s): 8ddd1af

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -5
README.md CHANGED
@@ -40,9 +40,8 @@ import torch
40
  from PIL import Image
41
  from transformers import VisionEncoderDecoderModel
42
  from transformers.models.nougat import NougatTokenizerFast
43
-
44
  from nougat_latex import NougatLaTexProcessor
45
- from nougat_latex.image_processing_nougat import NougatImageProcessor
46
 
47
  device = "cuda" if torch.cuda.is_available() else "cpu"
48
  # init model
@@ -51,15 +50,14 @@ model = VisionEncoderDecoderModel.from_pretrained("Norm/nougat-latex-base").to(d
51
  # init processor
52
  tokenizer = NougatTokenizerFast.from_pretrained("Norm/nougat-latex-base")
53
 
54
- image_processor = NougatImageProcessor.from_pretrained("Norm/nougat-latex-base")
55
- latex_processor = NougatLaTexProcessor(image_processor=image_processor)
56
 
57
  # run test
58
  image = Image.open("path/to/latex/image.png")
59
  if not image.mode == "RGB":
60
  image = image.convert('RGB')
61
 
62
- pixel_values = latex_processor(image)
63
 
64
  decoder_input_ids = tokenizer(tokenizer.bos_token, add_special_tokens=False,
65
  return_tensors="pt").input_ids
 
40
  from PIL import Image
41
  from transformers import VisionEncoderDecoderModel
42
  from transformers.models.nougat import NougatTokenizerFast
 
43
  from nougat_latex import NougatLaTexProcessor
44
+
45
 
46
  device = "cuda" if torch.cuda.is_available() else "cpu"
47
  # init model
 
50
  # init processor
51
  tokenizer = NougatTokenizerFast.from_pretrained("Norm/nougat-latex-base")
52
 
53
+ latex_processor = NougatLaTexProcessor.from_pretrained("Norm/nougat-latex-base")
 
54
 
55
  # run test
56
  image = Image.open("path/to/latex/image.png")
57
  if not image.mode == "RGB":
58
  image = image.convert('RGB')
59
 
60
+ pixel_values = latex_processor(image, return_tensors="pt").pixel_values
61
 
62
  decoder_input_ids = tokenizer(tokenizer.bos_token, add_special_tokens=False,
63
  return_tensors="pt").input_ids