Spaces:
Sleeping
Sleeping
File size: 799 Bytes
4f6b7c5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
#Importing the library
import keras_ocr
import gradio as gr
# keras-ocr will automatically download pretrained
# weights for the detector and recognizer.
pipeline = keras_ocr.pipeline.Pipeline()
def classify_image(file_name):
images = [keras_ocr.tools.read(file_name.name.replace("\\",'/'))]
prediction_groups = pipeline.recognize(images)
text = ""
for i in prediction_groups[0]:
text = text+ " " + i[0]
return text
image = gr.inputs.File( file_count="single",type="file", label="Fichier image à Traiter ")
# label = gr.outputs.Label(num_top_classes=3)
gr.Interface(
fn=classify_image,
inputs=image,
outputs="text",
interpretation="default",
title="API OCR",
description="Cette API est utilisé extraire du texte dans une image"
).launch() |