deepdoctection / app.py
JaMe76's picture
Create new file
ac7b15a
raw
history blame
No virus
851 Bytes
from deepdoctection.dataflow import DataFromList
from deepdoctection import get_dd_analyzer
import gradio as gr
def analyze_image(img):
# creating an image object and passing to the analyzer by using dataflows
image = Image(file_name="input.png", location="")
image.image = img
df = DataFromList(lst=[image])
analyzer = get_dd_analyzer(ocr=False)
df = analyzer.analyze(dataset_dataflow=df)
df.reset_state()
dp = next(iter(df))
return dp.viz(show_cells=False)
inputs = gr.inputs.Image(type='pil', label="Original Image")
outputs = gr.outputs.Image(type="pil", label="Output Image")
title = "Deepdoctection"
description = ""
# examples = [
# ['example-table.jpeg'],
# ['paper-image.jpeg']
# ]
gr.Interface(analyze_image, inputs, outputs, title=title, description=description, examples=examples).launch()