Update app.py
Browse files
app.py
CHANGED
|
@@ -15,9 +15,7 @@ def load_config():
|
|
| 15 |
return {
|
| 16 |
"translator": "google",
|
| 17 |
"lang_src": "en",
|
| 18 |
-
"lang_dst": "ar"
|
| 19 |
-
"font_path": "fonts/arabic-font.ttf",
|
| 20 |
-
"font_size": 20
|
| 21 |
}
|
| 22 |
|
| 23 |
# دالة الترجمة الرئيسية
|
|
@@ -38,7 +36,8 @@ def translate_image(image, translator_type="google", use_preprocess=True):
|
|
| 38 |
print(f"⚙️ استخدام المعالجة المسبقة: {use_preprocess}")
|
| 39 |
|
| 40 |
# استخراج النصوص مع أو بدون معالجة مسبقة
|
| 41 |
-
|
|
|
|
| 42 |
print(f"📊 النصوص المستخرجة: {texts}")
|
| 43 |
|
| 44 |
if not texts:
|
|
@@ -64,9 +63,9 @@ def translate_image(image, translator_type="google", use_preprocess=True):
|
|
| 64 |
return f"حدث خطأ: {str(e)}", None
|
| 65 |
|
| 66 |
# واجهة المستخدم
|
| 67 |
-
with gr.Blocks(title="Inkverta - مترجم المانغا
|
| 68 |
-
gr.Markdown("# 🎯 Inkverta - مترجم المانغا
|
| 69 |
-
gr.Markdown("**م
|
| 70 |
|
| 71 |
with gr.Row():
|
| 72 |
with gr.Column():
|
|
|
|
| 15 |
return {
|
| 16 |
"translator": "google",
|
| 17 |
"lang_src": "en",
|
| 18 |
+
"lang_dst": "ar"
|
|
|
|
|
|
|
| 19 |
}
|
| 20 |
|
| 21 |
# دالة الترجمة الرئيسية
|
|
|
|
| 36 |
print(f"⚙️ استخدام المعالجة المسبقة: {use_preprocess}")
|
| 37 |
|
| 38 |
# استخراج النصوص مع أو بدون معالجة مسبقة
|
| 39 |
+
# تم إصلاح الخطأ: إزالة min_score من الاستدعاء
|
| 40 |
+
texts, boxes = extract_texts(image_path, preprocess=use_preprocess)
|
| 41 |
print(f"📊 النصوص المستخرجة: {texts}")
|
| 42 |
|
| 43 |
if not texts:
|
|
|
|
| 63 |
return f"حدث خطأ: {str(e)}", None
|
| 64 |
|
| 65 |
# واجهة المستخدم
|
| 66 |
+
with gr.Blocks(title="Inkverta - مترجم المانغا") as demo:
|
| 67 |
+
gr.Markdown("# 🎯 Inkverta - مترجم المانغا")
|
| 68 |
+
gr.Markdown("**مترجم المانغا الذكي مع تحسين تلقائي للصور**")
|
| 69 |
|
| 70 |
with gr.Row():
|
| 71 |
with gr.Column():
|