Spaces:
Runtime error
Runtime error
| #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", | |
| theme="dark-peach", | |
| title="API OCR", | |
| description="Cette API est utilisé extraire du texte dans une image" | |
| ).launch() |