Image-to-Text
Transformers
pixeltext
feature-extraction
ocr
vision-language
paligemma
custom-model
text-extraction
document-ai
multi-language
custom_code
Instructions to use BabaK07/pixeltext-ai with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BabaK07/pixeltext-ai with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("image-to-text", model="BabaK07/pixeltext-ai", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("BabaK07/pixeltext-ai", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
| #!/usr/bin/env python3 | |
| """ | |
| Test script for the FIXED pixeltext-ai model | |
| """ | |
| from transformers import AutoModel | |
| from PIL import Image, ImageDraw, ImageFont | |
| def test_fixed_model(): | |
| """Test the fixed model.""" | |
| print("🧪 Testing FIXED pixeltext-ai model...") | |
| # Load model from Hub | |
| model = AutoModel.from_pretrained("BabaK07/pixeltext-ai", trust_remote_code=True) | |
| # Create test image | |
| img = Image.new('RGB', (400, 200), color='white') | |
| draw = ImageDraw.Draw(img) | |
| try: | |
| font = ImageFont.truetype("/System/Library/Fonts/Arial.ttf", 20) | |
| except: | |
| font = ImageFont.load_default() | |
| draw.text((20, 50), "FIXED MODEL TEST", fill='black', font=font) | |
| draw.text((20, 100), "Hub loading works!", fill='blue', font=font) | |
| draw.text((20, 150), "from_pretrained success!", fill='green', font=font) | |
| # Extract text | |
| result = model.generate_ocr_text(img) | |
| print(f"📝 Results:") | |
| print(f" Text: {result['text']}") | |
| print(f" Confidence: {result['confidence']:.1%}") | |
| print(f" Success: {result['success']}") | |
| print(f" Method: {result['method']}") | |
| if result['success']: | |
| print("✅ FIXED MODEL WORKING PERFECTLY!") | |
| else: | |
| print("❌ Still has issues") | |
| return result | |
| if __name__ == "__main__": | |
| test_fixed_model() | |