Instructions to use Ali0044/Qalam-Net with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use Ali0044/Qalam-Net with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://Ali0044/Qalam-Net") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -12,11 +12,11 @@ tags:
|
|
| 12 |
|
| 13 |
# Qalam-Net (قلم-نت): Advanced Arabic OCR (v2 Portable)
|
| 14 |
|
| 15 |
-
Qalam-Net is a high-performance, cross-backend Optical Character Recognition (OCR) model for Arabic.
|
| 16 |
|
| 17 |
-
## 🚀 Quick Start (
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
### 1. Installation
|
| 22 |
```bash
|
|
@@ -31,12 +31,17 @@ os.environ["KERAS_BACKEND"] = "jax" # Options: "jax", "tensorflow", "torch"
|
|
| 31 |
import keras
|
| 32 |
import numpy as np
|
| 33 |
import cv2
|
|
|
|
| 34 |
|
| 35 |
class QalamNet:
|
| 36 |
def __init__(self, repo_id="Ali0044/Qalam-Net"):
|
| 37 |
-
#
|
| 38 |
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
# Standard Arabic Vocabulary
|
| 42 |
self.vocab = [' ', '!', '"', '#', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '=', '?', '[', ']', 'ء', 'آ', 'أ', 'ؤ', 'إ', 'ئ', 'ا', 'ب', 'ة', 'ت', 'ث', 'ج', 'ح', 'خ', 'د', 'ذ', 'ر', 'ز', 'س', 'ش', 'ص', 'ض', 'ط', 'ظ', 'ع', 'غ', 'ـ', 'ف', 'ق', 'ك', 'ل', 'م', 'ن', 'ه', 'و', 'ى', 'ي', 'ً', 'ٌ', 'ٍ', 'َ', 'ُ', 'ِ', 'ّ', 'ْ', '٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩']
|
|
|
|
| 12 |
|
| 13 |
# Qalam-Net (قلم-نت): Advanced Arabic OCR (v2 Portable)
|
| 14 |
|
| 15 |
+
Qalam-Net is a high-performance, cross-backend Optical Character Recognition (OCR) model for Arabic. Built on **Keras 3**, it supports **JAX**, **PyTorch**, and **TensorFlow** backends.
|
| 16 |
|
| 17 |
+
## 🚀 Quick Start (Robust Usage)
|
| 18 |
|
| 19 |
+
For maximum reliability across all environments, use the `huggingface_hub` downloader.
|
| 20 |
|
| 21 |
### 1. Installation
|
| 22 |
```bash
|
|
|
|
| 31 |
import keras
|
| 32 |
import numpy as np
|
| 33 |
import cv2
|
| 34 |
+
from huggingface_hub import hf_hub_download
|
| 35 |
|
| 36 |
class QalamNet:
|
| 37 |
def __init__(self, repo_id="Ali0044/Qalam-Net"):
|
| 38 |
+
# 1. Download the portable model file from the Hub
|
| 39 |
+
print(f"Downloading model from {repo_id}...")
|
| 40 |
+
model_path = hf_hub_download(repo_id=repo_id, filename="model.keras")
|
| 41 |
+
|
| 42 |
+
# 2. Load the model (Self-contained v2 requires no custom_objects)
|
| 43 |
+
self.model = keras.saving.load_model(model_path)
|
| 44 |
+
print("Model loaded successfully!")
|
| 45 |
|
| 46 |
# Standard Arabic Vocabulary
|
| 47 |
self.vocab = [' ', '!', '"', '#', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '=', '?', '[', ']', 'ء', 'آ', 'أ', 'ؤ', 'إ', 'ئ', 'ا', 'ب', 'ة', 'ت', 'ث', 'ج', 'ح', 'خ', 'د', 'ذ', 'ر', 'ز', 'س', 'ش', 'ص', 'ض', 'ط', 'ظ', 'ع', 'غ', 'ـ', 'ف', 'ق', 'ك', 'ل', 'م', 'ن', 'ه', 'و', 'ى', 'ي', 'ً', 'ٌ', 'ٍ', 'َ', 'ُ', 'ِ', 'ّ', 'ْ', '٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩']
|