Spaces:
Running
Running
# -*- encoding: utf-8 -*- | |
# @Author: SWHL | |
# @Contact: liekkaskono@163.com | |
import streamlit as st | |
from paddleocr_convert import PaddleOCRModelConvert | |
converter = PaddleOCRModelConvert() | |
st.header("PaddleOCRModelConverter Online") | |
eg_url = 'https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_det_infer.tar' | |
url = st.text_input('输入模型地址:', placeholder=eg_url) | |
eg_txt_url = 'https://raw.githubusercontent.com/PaddlePaddle/PaddleOCR/release/2.6/ppocr/utils/dict/chinese_cht_dict.txt' | |
txt_url = st.text_input('输入txt地址(文本识别模型时,必选):', placeholder=eg_txt_url) | |
save_dir = 'models' | |
col1, col2 = st.columns(2) | |
with col1: | |
is_convert = st.button('Convert') | |
if is_convert: | |
converter(url, save_dir, txt_path=txt_url) | |
with col2: | |
is_download = st.download_button('Download', '') | |