Spaces:
Build error
Build error
from mmocr.ocr import MMOCR | |
import gradio as gr | |
import cv2 | |
model_dir = 'model' | |
ocr = MMOCR(det_config=f'{model_dir}/config.py', | |
det_ckpt=f'{model_dir}/epoch_40.pth', device='cpu') | |
def predict(inp): | |
return str(ocr.readtext(inp)) | |
def run(): | |
demo = gr.Interface( | |
fn=predict, | |
inputs=gr.inputs.Image(), | |
outputs=gr.outputs.Textbox(), | |
) | |
demo.launch(server_name="0.0.0.0", server_port=7860) | |
if __name__ == "__main__": | |
run() |