Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ class OCRProcessor:
|
|
16 |
|
17 |
class PersianQAModel:
|
18 |
def __init__(self):
|
19 |
-
model_name = "
|
20 |
try:
|
21 |
self.qa_pipeline = pipeline(
|
22 |
"question-answering",
|
@@ -42,9 +42,7 @@ ocr_processor = OCRProcessor()
|
|
42 |
qa_model = PersianQAModel()
|
43 |
|
44 |
def pipeline_fn(image, question):
|
45 |
-
# استخراج متن از تصویر
|
46 |
context = ocr_processor.extract_text(image)
|
47 |
-
# پاسخ به سوال بر اساس متن
|
48 |
answer = qa_model.answer_question(context, question)
|
49 |
return context, answer
|
50 |
|
|
|
16 |
|
17 |
class PersianQAModel:
|
18 |
def __init__(self):
|
19 |
+
model_name = "HooshvareLab/bert-fa-qa"
|
20 |
try:
|
21 |
self.qa_pipeline = pipeline(
|
22 |
"question-answering",
|
|
|
42 |
qa_model = PersianQAModel()
|
43 |
|
44 |
def pipeline_fn(image, question):
|
|
|
45 |
context = ocr_processor.extract_text(image)
|
|
|
46 |
answer = qa_model.answer_question(context, question)
|
47 |
return context, answer
|
48 |
|