Spaces:
Running
on
Zero
Running
on
Zero
| from PIL import Image, ImageDraw, ImageFont | |
| import os | |
| def create_sample_image(text, filename): | |
| # Create a white image | |
| img = Image.new('RGB', (800, 400), color=(255, 255, 255)) | |
| d = ImageDraw.Draw(img) | |
| # Try to load a default font | |
| try: | |
| # On macOS, this might work | |
| font = ImageFont.truetype("/System/Library/Fonts/Supplemental/Arial.ttf", 40) | |
| except: | |
| font = ImageFont.load_default() | |
| d.text((100, 150), text, fill=(0, 0, 0), font=font) | |
| img.save(filename) | |
| print(f"Created {filename}") | |
| if __name__ == "__main__": | |
| create_sample_image("DeepSeek-OCR-2 test. Hello World!", "sample_test.png") | |