OmidSakaki commited on
Commit
fc0e7b8
·
verified ·
1 Parent(s): fa63a5d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -5,14 +5,15 @@ from PIL import 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):
 
5
  import os
6
 
7
  # --- مدل‌ها ---
 
 
8
  try:
9
+ model_name = "persiannlp/mt5-small-parsinlu-opus-translation"
10
+
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
+
15
  except Exception as e:
16
+ raise gr.Error(f"خطا در بارگذاری مدل‌ها: لطفاً از موجود بودن مدل اطمینان حاصل کنید. خطا: {str(e)}")
17
 
18
  # --- توابع پردازش ---
19
  def run_ocr(image):