MQAnh commited on
Commit
abae8fb
·
verified ·
1 Parent(s): b45bfd6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -6,8 +6,8 @@ import torch
6
  device = "cuda" if torch.cuda.is_available() else "cpu"
7
 
8
  # Load the model
9
- processor = TrOCRProcessor.from_pretrained("microsoft/trocr-large-handwritten")
10
- model = VisionEncoderDecoderModel.from_pretrained("microsoft/trocr-large-handwritten").to(device)
11
 
12
  def ocr_infer(image):
13
  pixel_values = processor(images=image, return_tensors="pt").pixel_values.to(device)
@@ -20,7 +20,7 @@ iface = gr.Interface(
20
  fn=ocr_infer,
21
  inputs=gr.Image(type="pil"),
22
  outputs="text",
23
- title="Image to Text (OCR) ver6",
24
  description="Upload a handwritten or printed image to extract text using TrOCR."
25
  )
26
 
 
6
  device = "cuda" if torch.cuda.is_available() else "cpu"
7
 
8
  # Load the model
9
+ processor = TrOCRProcessor.from_pretrained("MQAnh/my-awesome-model")
10
+ model = VisionEncoderDecoderModel.from_pretrained("MQAnh/my-awesome-model").to(device)
11
 
12
  def ocr_infer(image):
13
  pixel_values = processor(images=image, return_tensors="pt").pixel_values.to(device)
 
20
  fn=ocr_infer,
21
  inputs=gr.Image(type="pil"),
22
  outputs="text",
23
+ title="Image to Text (OCR) ver7",
24
  description="Upload a handwritten or printed image to extract text using TrOCR."
25
  )
26