Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,9 +5,14 @@ from PIL import Image
|
|
5 |
import os
|
6 |
|
7 |
# --- مدلها ---
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
# --- توابع پردازش ---
|
13 |
def run_ocr(image):
|
|
|
5 |
import os
|
6 |
|
7 |
# --- مدلها ---
|
8 |
+
model_name = "persiannlp/mt5-base-parsinlu-opus-translation"
|
9 |
+
|
10 |
+
try:
|
11 |
+
ocr_model = PaddleOCR(lang='fa', use_textline_orientation=True)
|
12 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
13 |
+
nlp_model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
14 |
+
except Exception as e:
|
15 |
+
raise gr.Error(f"خطا در بارگذاری مدلها: {str(e)}")
|
16 |
|
17 |
# --- توابع پردازش ---
|
18 |
def run_ocr(image):
|