File size: 648 Bytes
7b44188
 
 
82f540a
 
7b44188
 
 
 
 
 
 
82f540a
 
 
 
 
 
 
7b44188
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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()