PYTHON2DAY Telegram 7399
😱 HunyuanOCR — это не обычный OCR, который путает буквы и плачет от плохого качества.

Распознаёт текст на фото, сканах и даже кривых телефонных снимках с точностью, что ставит Google Vision в неловкое положение.

Что умеет:
📸 Считывает текст на любых изображениях — документы, фото, меню, вывески, рукописные заметки.
🧠 Мощная модель от Tencent — понимает структуру, расположение блоков, выделяет зоны текста.
🌚 Работает даже на плохих фото — шум, тени, наклон, бликующий экран — распознаёт всё.
😰 Есть Python-интерфейс — можно встроить в бота, сервис или свою автоматизацию.
🗂 Разбирает сложные макеты — таблицы, колонки, многостраничные файлы.
🆓 Полностью бесплатно и open-source.

Где будет полезно:
🟢делай сервис распознавания чеков и документов;
🟢автоматизируй ввод данных для бизнеса;
🟢продавай обработку сканов на фрилансе;
🟢собирай «умного» Telegram-бота для OCR;
🟢создавай SaaS под маркетплейсы и бухгалтерию.

Пример использования:
from vllm import LLM, SamplingParams
from PIL import Image
from transformers import AutoProcessor

def clean_repeated_substrings(text):
"""Clean repeated substrings in text"""
n = len(text)
if n<8000:
return text
for length in range(2, n // 10 + 1):
candidate = text[-length:]
count = 0
i = n - length

while i >= 0 and text[i:i + length] == candidate:
count += 1
i -= length

if count >= 10:
return text[:n - length * (count - 1)]

return text

model_path = "tencent/HunyuanOCR"
llm = LLM(model=model_path, trust_remote_code=True)
processor = AutoProcessor.from_pretrained(model_path)
sampling_params = SamplingParams(temperature=0, max_tokens=16384)

img_path = "/path/to/image.jpg"
img = Image.open(img_path)
messages = [
{"role": "system", "content": ""},
{"role": "user", "content": [
{"type": "image", "image": img_path},
{"type": "text", "text": "检测并识别图片中的文字,将文本坐标格式化输出。"}
]}
]
prompt = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = {"prompt": prompt, "multi_modal_data": {"image": [img]}}
output = llm.generate([inputs], sampling_params)[0]
print(clean_repeated_substrings(output.outputs[0].text))


♎️ GitHub/Инструкция

#python #soft #github
Please open Telegram to view this post
VIEW IN TELEGRAM
👍44🔥303



tgoop.com/python2day/7399
Create:
Last Update:

😱 HunyuanOCR — это не обычный OCR, который путает буквы и плачет от плохого качества.

Распознаёт текст на фото, сканах и даже кривых телефонных снимках с точностью, что ставит Google Vision в неловкое положение.

Что умеет:
📸 Считывает текст на любых изображениях — документы, фото, меню, вывески, рукописные заметки.
🧠 Мощная модель от Tencent — понимает структуру, расположение блоков, выделяет зоны текста.
🌚 Работает даже на плохих фото — шум, тени, наклон, бликующий экран — распознаёт всё.
😰 Есть Python-интерфейс — можно встроить в бота, сервис или свою автоматизацию.
🗂 Разбирает сложные макеты — таблицы, колонки, многостраничные файлы.
🆓 Полностью бесплатно и open-source.

Где будет полезно:
🟢делай сервис распознавания чеков и документов;
🟢автоматизируй ввод данных для бизнеса;
🟢продавай обработку сканов на фрилансе;
🟢собирай «умного» Telegram-бота для OCR;
🟢создавай SaaS под маркетплейсы и бухгалтерию.

Пример использования:

from vllm import LLM, SamplingParams
from PIL import Image
from transformers import AutoProcessor

def clean_repeated_substrings(text):
"""Clean repeated substrings in text"""
n = len(text)
if n<8000:
return text
for length in range(2, n // 10 + 1):
candidate = text[-length:]
count = 0
i = n - length

while i >= 0 and text[i:i + length] == candidate:
count += 1
i -= length

if count >= 10:
return text[:n - length * (count - 1)]

return text

model_path = "tencent/HunyuanOCR"
llm = LLM(model=model_path, trust_remote_code=True)
processor = AutoProcessor.from_pretrained(model_path)
sampling_params = SamplingParams(temperature=0, max_tokens=16384)

img_path = "/path/to/image.jpg"
img = Image.open(img_path)
messages = [
{"role": "system", "content": ""},
{"role": "user", "content": [
{"type": "image", "image": img_path},
{"type": "text", "text": "检测并识别图片中的文字,将文本坐标格式化输出。"}
]}
]
prompt = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = {"prompt": prompt, "multi_modal_data": {"image": [img]}}
output = llm.generate([inputs], sampling_params)[0]
print(clean_repeated_substrings(output.outputs[0].text))


♎️ GitHub/Инструкция

#python #soft #github

BY [PYTHON:TODAY]




Share with your friend now:
tgoop.com/python2day/7399

View MORE
Open in Telegram


Telegram News

Date: |

It’s yet another bloodbath on Satoshi Street. As of press time, Bitcoin (BTC) and the broader cryptocurrency market have corrected another 10 percent amid a massive sell-off. Ethereum (EHT) is down a staggering 15 percent moving close to $1,000, down more than 42 percent on the weekly chart. 6How to manage your Telegram channel? The initiatives announced by Perekopsky include monitoring the content in groups. According to the executive, posts identified as lacking context or as containing false information will be flagged as a potential source of disinformation. The content is then forwarded to Telegram's fact-checking channels for analysis and subsequent publication of verified information. Add the logo from your device. Adjust the visible area of your image. Congratulations! Now your Telegram channel has a face Click “Save”.! In handing down the sentence yesterday, deputy judge Peter Hui Shiu-keung of the district court said that even if Ng did not post the messages, he cannot shirk responsibility as the owner and administrator of such a big group for allowing these messages that incite illegal behaviors to exist.
from us


Telegram [PYTHON:TODAY]
FROM American