|
|
| title = """# 🙋🏻♂️Welcome to Tonic's🫴🏻📸GOT-OCR |
| --- |
| """ |
|
|
| description = """ |
| The **GOT-OCR model** is a cutting-edge OCR system with **580M parameters**, designed to process a wide range of "characters." Equipped with a **high-compression encoder** and a **long-context decoder**, it excels in both scene and document-style images. The model supports **multi-page** and **dynamic resolution OCR**, enhancing its versatility. |
| |
| ### Key Features |
| |
| - **Plain Text OCR**: Extracts text from images. |
| - **Formatted Text OCR**: Retains the original formatting, including tables and formulas. |
| - **Fine-grained OCR**: Offers box-based and color-based OCR for precision in specific regions. |
| - **Multi-crop OCR**: Handles multiple cropped sections within an image. |
| |
| ## Supported Content Types |
| |
| - Plain text |
| - Math/molecular formulas |
| - Tables and charts |
| - Sheet music |
| - Geometric shapes |
| |
| """ |
| joinus = """ |
| ## Join us : |
| |
| 🌟TeamTonic🌟 is always making cool demos! Join our active builder's 🛠️community 👻 [](https://discord.gg/qdfnvSPcqP) On 🤗Huggingface:[MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Tonic-AI](https://github.com/tonic-ai) & contribute to🌟 [Build Tonic](https://git.tonic-ai.com/contribute)🤗Big thanks to Yuvi Sharma and all the folks at huggingface for the community grant 🤗 |
| """ |
| modelinfor = """ |
| ## How to Use |
| |
| 1. Select a task from the dropdown menu. |
| 2. Upload an image. |
| 3. (Optional) Adjust parameters based on the selected task. |
| 4. Click **Process** to view the results. |
| |
| ## Model Information |
| |
| - **Model Name**: GOT-OCR 2.0 |
| - **Hugging Face Repository**: [ucaslcl/GOT-OCR2_0](https://huggingface.co/ucaslcl/GOT-OCR2_0) |
| - **Environment**: CUDA 11.8 + PyTorch 2.0.1 |
| |
| """ |
|
|
| tasks = [ |
| "Plain Text OCR", |
| "Format Text OCR", |
| "Fine-grained OCR (Box)", |
| "Fine-grained OCR (Color)", |
| "Multi-crop OCR", |
| "Render Formatted OCR" |
| ] |
|
|
| ocr_types = ["ocr", "format"] |
| ocr_colors = ["red", "green", "blue"] |
|
|
| howto = """ |
| ## To use Fine-grained OCR (Color): |
| 1. Click on 'Fine-grained OCR (Color)' in the task dropdown. |
| 2. Set 'OCR Type' to 'ocr'. |
| 3. This will display the image editor. |
| 4. Upload an image to the editor. |
| 5. Use the drawing tools to draw a circle around the text you want to OCR. |
| 6. Select the color that matches your circle in the 'OCR Color' dropdown. |
| 7. Click 'Process Edited Image' to run the OCR on the selected area. |
| """ |
| |