nernlp / app.py
MIRNA-MOUKHTAR2025's picture
Upload 2 files
b616634 verified
raw
history blame contribute delete
796 Bytes
import gradio as gr
from transformers import pipeline
# Load the pre-trained BioBERT model for NER
nlp_ner = pipeline("ner", model="dmis-lab/biobert-base-cased-v1.1", tokenizer="dmis-lab/biobert-base-cased-v1.1")
def ner_micobiology(abstract):
entities = nlp_ner(abstract)
return entities
# Gradio Interface for NER
iface = gr.Interface(
fn=ner_micobiology,
inputs=gr.Textbox(label="Enter Microbiology Abstract", placeholder="Paste or type your microbiology abstract here..."),
outputs="json",
live=True,
title="Microbiology Named Entity Recognition with BioBERT",
description="Extract named entities from your microbiology abstract using BioBERT for NER."
)
# Launch the Gradio interface
if __name__ == "__main__":
iface.launch()