Spaces:
Runtime error
Runtime error
File size: 491 Bytes
497cbba |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import os
os.system('pip3 install muggle_ocr -i https://pypi.douban.com/simple/')
import gradio as gr
import muggle_ocr
import cv2
captcha_sdk = muggle_ocr.SDK(model_type=muggle_ocr.ModelType.OCR)
def generate(img):
success,encoded_image = cv2.imencode(".jpg",img)
b_img = encoded_image.tostring()
return captcha_sdk.predict(image_bytes=b_img)
if __name__ == "__main__":
gr.Interface(
fn=generate,
inputs="image",
outputs="text"
).launch() |