import gradio as gr from transformers import pipeline # Load the NER pipeline ner_pipeline = pipeline("ner", model="dslim/bert-base-NER", grouped_entities=True) # Define the prediction function def recognize_entities(text): results = ner_pipeline(text) return str(results) # Gradio UI iface = gr.Interface(fn=recognize_entities, inputs=gr.Textbox(lines=5, placeholder="Enter your text here..."), outputs="text", title="Named Entity Recognition (NER)", description="Using dslim/bert-base-NER model to identify named entities in text.") # Launch iface.launch()