Spaces:
Runtime error
Runtime error
import os | |
os.system('pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu102/torch1.9/index.html') | |
from deepdoctection.dataflow import DataFromList | |
from deepdoctection import get_dd_analyzer | |
from deepdoctection import Image | |
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[:,:,::-1] | |
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='numpy', label="Original Image") | |
outputs = gr.outputs.Image(type="numpy", label="Output Image") | |
title = "Deepdoctection" | |
description = "" | |
examples = [['sample_1.jpg'],['sample_2.png']] | |
gr.Interface(analyze_image, inputs, outputs, title=title, description=description, examples=examples).launch() |