Spaces:
Sleeping
Sleeping
Fix: TrOCR model ID and numpy version
Browse files
app.py
CHANGED
|
@@ -10,10 +10,10 @@ from paddleocr import PaddleOCR # Ensure paddleocr is installed and its dependen
|
|
| 10 |
# --- Global Model Loading ---
|
| 11 |
# Load the pre-trained TrOCR model and processor from Hugging Face Hub
|
| 12 |
# IMPORTANT: Replace "your-username/my-handwritten-trocr" with your actual model's repository ID
|
| 13 |
-
#
|
| 14 |
try:
|
| 15 |
-
processor = TrOCRProcessor.from_pretrained("
|
| 16 |
-
model = VisionEncoderDecoderModel.from_pretrained("
|
| 17 |
model.eval() # Set model to evaluation mode
|
| 18 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 19 |
model.to(device)
|
|
|
|
| 10 |
# --- Global Model Loading ---
|
| 11 |
# Load the pre-trained TrOCR model and processor from Hugging Face Hub
|
| 12 |
# IMPORTANT: Replace "your-username/my-handwritten-trocr" with your actual model's repository ID
|
| 13 |
+
# For example, if you pushed your model to 'imperiusrex/my-handwritten-trocr', use that ID below.
|
| 14 |
try:
|
| 15 |
+
processor = TrOCRProcessor.from_pretrained("imperiusrex/my-handwritten-trocr") # <--- UPDATED THIS LINE
|
| 16 |
+
model = VisionEncoderDecoderModel.from_pretrained("imperiusrex/my-handwritten-trocr") # <--- UPDATED THIS LINE
|
| 17 |
model.eval() # Set model to evaluation mode
|
| 18 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 19 |
model.to(device)
|