med_assis / app.py
LaibaJ's picture
Update app.py
82f540a verified
raw
history blame contribute delete
648 Bytes
import gradio as gr
from transformers import pipeline
# Load your model with aggregation (recommended for NER)
model = pipeline("ner", model="blaze999/Medical-NER", aggregation_strategy="simple")
# Define the function
def recognize_entities(text):
result = model(text)
return result
# Create the Gradio interface
interface = gr.Interface(
fn=recognize_entities,
inputs=gr.Textbox(lines=4, placeholder="Enter medical text here..."),
outputs="json",
title="Medical Named Entity Recognition",
description="This app uses a custom model to recognize medical entities in text."
)
# Launch the interface
interface.launch()