import gradio as gr def ner(text): api = gr.Interface.load("browndw/docusco-bert", src='models') spans = api(text) replaced_spans = [(key, None) if value=='O' else (key, value) for (key, value) in spans] return replaced_spans interface = gr.Interface(ner, inputs=gr.Textbox(label="Input", value="Autophagy maintains tumour growth through circulating arginine. Acute, \ whole-body deletion of the essential autophagy gene Atg7 in adult mice causes a systemic metabolic defect that manifests as starvation \ intolerance and gradual loss of white adipose tissue, liver glycogen and muscle mass. Cancer cells also benefit from autophagy."), outputs="highlightedtext") interface.launch()