OmidSakaki commited on
Commit
7a79275
·
verified ·
1 Parent(s): d3485e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -5,9 +5,14 @@ from PIL import Image
5
  import os
6
 
7
  # --- مدل‌ها ---
8
- ocr_model = PaddleOCR(lang='fa', use_textline_orientation=True)
9
- tokenizer = AutoTokenizer.from_pretrained("persiannlp/mt5-small-parsinlu-grammar-correction")
10
- nlp_model = AutoModelForSeq2SeqLM.from_pretrained("persiannlp/mt5-small-parsinlu-grammar-correction")
 
 
 
 
 
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):