Update app.py
Browse files
app.py
CHANGED
|
@@ -2,16 +2,19 @@ import os
|
|
| 2 |
os.system('pip3 install muggle_ocr -i https://pypi.douban.com/simple/')
|
| 3 |
import gradio as gr
|
| 4 |
import muggle_ocr
|
|
|
|
| 5 |
|
| 6 |
captcha_sdk = muggle_ocr.SDK(model_type=muggle_ocr.ModelType.Captcha)
|
| 7 |
|
| 8 |
-
def generate(
|
|
|
|
|
|
|
| 9 |
return "1234"
|
| 10 |
|
| 11 |
if __name__ == "__main__":
|
| 12 |
|
| 13 |
gr.Interface(
|
| 14 |
fn=generate,
|
| 15 |
-
inputs="
|
| 16 |
outputs="text"
|
| 17 |
).launch()
|
|
|
|
| 2 |
os.system('pip3 install muggle_ocr -i https://pypi.douban.com/simple/')
|
| 3 |
import gradio as gr
|
| 4 |
import muggle_ocr
|
| 5 |
+
import cv2
|
| 6 |
|
| 7 |
captcha_sdk = muggle_ocr.SDK(model_type=muggle_ocr.ModelType.Captcha)
|
| 8 |
|
| 9 |
+
def generate(img):
|
| 10 |
+
success,encoded_image = cv2.imencode(".jpg",img)
|
| 11 |
+
img_bytes = encoded_image.tostring()
|
| 12 |
return "1234"
|
| 13 |
|
| 14 |
if __name__ == "__main__":
|
| 15 |
|
| 16 |
gr.Interface(
|
| 17 |
fn=generate,
|
| 18 |
+
inputs="image",
|
| 19 |
outputs="text"
|
| 20 |
).launch()
|