Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ from PIL import Image
|
|
4 |
import torch
|
5 |
from torchvision import transforms
|
6 |
import matplotlib.pyplot as plt
|
|
|
7 |
|
8 |
# Load TrOCR model
|
9 |
processor = TrOCRProcessor.from_pretrained("microsoft/trocr-large-handwritten")
|
@@ -28,6 +29,7 @@ def visualize_image(pixel_values):
|
|
28 |
plt.title("Preprocessed Image")
|
29 |
plt.show()
|
30 |
|
|
|
31 |
def recognize_text(image):
|
32 |
try:
|
33 |
# Preprocess the image
|
|
|
4 |
import torch
|
5 |
from torchvision import transforms
|
6 |
import matplotlib.pyplot as plt
|
7 |
+
import spaces
|
8 |
|
9 |
# Load TrOCR model
|
10 |
processor = TrOCRProcessor.from_pretrained("microsoft/trocr-large-handwritten")
|
|
|
29 |
plt.title("Preprocessed Image")
|
30 |
plt.show()
|
31 |
|
32 |
+
@spaces.GPU
|
33 |
def recognize_text(image):
|
34 |
try:
|
35 |
# Preprocess the image
|