File size: 694 Bytes
6929a81
670ae57
6929a81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# import gradio as gr

# gr.load("models/Clinical-AI-Apollo/Medical-NER").launch()
import streamlit as st
from transformers import pipeline

pipe = pipeline("ner", model="Clinical-AI-Apollo/Medical-NER")

def main():
    text_input = st.text_area("Enter text:")

    if text_input:
        if text_input.strip() != "":
            # Perform NER on the input text
            entities = pipe(text_input)
            st.write("Entities:")
            for entity in entities:
                st.write(f"- Entity: {entity['word']}, Type: {entity['entity']}")
        else:
            st.write("Please enter some text to extract entities.")

if __name__ == "__main__":
    main()

pipe = pipeline()