badalprasadsingh commited on
Commit
6929a81
1 Parent(s): 670ae57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -2
app.py CHANGED
@@ -1,3 +1,25 @@
1
- import gradio as gr
2
 
3
- gr.load("models/Clinical-AI-Apollo/Medical-NER").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # import gradio as gr
2
 
3
+ # gr.load("models/Clinical-AI-Apollo/Medical-NER").launch()
4
+ import streamlit as st
5
+ from transformers import pipeline
6
+
7
+ pipe = pipeline("ner", model="Clinical-AI-Apollo/Medical-NER")
8
+
9
+ def main():
10
+ text_input = st.text_area("Enter text:")
11
+
12
+ if text_input:
13
+ if text_input.strip() != "":
14
+ # Perform NER on the input text
15
+ entities = pipe(text_input)
16
+ st.write("Entities:")
17
+ for entity in entities:
18
+ st.write(f"- Entity: {entity['word']}, Type: {entity['entity']}")
19
+ else:
20
+ st.write("Please enter some text to extract entities.")
21
+
22
+ if __name__ == "__main__":
23
+ main()
24
+
25
+ pipe = pipeline()