Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,17 +11,18 @@ import numpy as np
|
|
| 11 |
|
| 12 |
# Model configurations
|
| 13 |
MODEL_CONFIGS = {
|
| 14 |
-
|
| 15 |
-
"name": "oddadmix/Qari-OCR-0.2.2.1-VL-2B-Instruct-merged",
|
| 16 |
-
"class": Qwen2VLForConditionalGeneration,
|
| 17 |
-
"prompt": "Below is the image of one page of a document, as well as some raw textual content that was previously extracted for it. Just return the plain text representation of this document as if you were reading it naturally. Do not hallucinate.",
|
| 18 |
-
"use_qwen3": False
|
| 19 |
-
},
|
| 20 |
"KATIB OCR 0.8B 0.1": {
|
| 21 |
"name": "oddadmix/Katib-Qwen3.5-0.8B-0.3",
|
| 22 |
"class": AutoModelForImageTextToText,
|
| 23 |
"prompt": "Free OCR.",
|
| 24 |
"use_qwen3": True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
}
|
| 26 |
}
|
| 27 |
|
|
@@ -129,8 +130,8 @@ def perform_ocr(image, model_choice):
|
|
| 129 |
return output_text
|
| 130 |
|
| 131 |
# Create Gradio interface
|
| 132 |
-
with gr.Blocks(title="
|
| 133 |
-
gr.Markdown("#
|
| 134 |
gr.Markdown("Upload an image to extract Arabic text in real-time. Choose between different OCR models.")
|
| 135 |
|
| 136 |
with gr.Row():
|
|
@@ -170,10 +171,10 @@ with gr.Blocks(title="Qari Arabic OCR - Multi-Model") as demo:
|
|
| 170 |
gr.Markdown("""
|
| 171 |
**Available Models:**
|
| 172 |
|
| 173 |
-
1. **
|
| 174 |
-
- Model:
|
| 175 |
-
- Based on Qwen3
|
| 176 |
-
- Size:
|
| 177 |
|
| 178 |
2. **Qari OCR 0.2.2.1**
|
| 179 |
- Model: NAMAA-Space/Qari-OCR-0.2.2.1-VL-2B-Instruct
|
|
|
|
| 11 |
|
| 12 |
# Model configurations
|
| 13 |
MODEL_CONFIGS = {
|
| 14 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
"KATIB OCR 0.8B 0.1": {
|
| 16 |
"name": "oddadmix/Katib-Qwen3.5-0.8B-0.3",
|
| 17 |
"class": AutoModelForImageTextToText,
|
| 18 |
"prompt": "Free OCR.",
|
| 19 |
"use_qwen3": True
|
| 20 |
+
},
|
| 21 |
+
"Qari OCR 0.2.2.1": {
|
| 22 |
+
"name": "oddadmix/Qari-OCR-0.2.2.1-VL-2B-Instruct-merged",
|
| 23 |
+
"class": Qwen2VLForConditionalGeneration,
|
| 24 |
+
"prompt": "Below is the image of one page of a document, as well as some raw textual content that was previously extracted for it. Just return the plain text representation of this document as if you were reading it naturally. Do not hallucinate.",
|
| 25 |
+
"use_qwen3": False
|
| 26 |
}
|
| 27 |
}
|
| 28 |
|
|
|
|
| 130 |
return output_text
|
| 131 |
|
| 132 |
# Create Gradio interface
|
| 133 |
+
with gr.Blocks(title="Arabic OCR Models Demo") as demo:
|
| 134 |
+
gr.Markdown("# Arabic OCR Models Demo")
|
| 135 |
gr.Markdown("Upload an image to extract Arabic text in real-time. Choose between different OCR models.")
|
| 136 |
|
| 137 |
with gr.Row():
|
|
|
|
| 171 |
gr.Markdown("""
|
| 172 |
**Available Models:**
|
| 173 |
|
| 174 |
+
1. **KATIB OCR 0.1 0.8B **
|
| 175 |
+
- Model: oddadmix/Katib-Qwen3.5-0.8B-0.1
|
| 176 |
+
- Based on Qwen3.5
|
| 177 |
+
- Size: 0.8B parameters
|
| 178 |
|
| 179 |
2. **Qari OCR 0.2.2.1**
|
| 180 |
- Model: NAMAA-Space/Qari-OCR-0.2.2.1-VL-2B-Instruct
|