parthjain commited on
Commit
3c7183d
·
verified ·
1 Parent(s): cf47519

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +22 -0
  2. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ ner_model = pipeline(
5
+ "ner",
6
+ model="dslim/bert-base-NER",
7
+ aggregation_strategy="simple"
8
+ )
9
+
10
+ def ner_inference(text):
11
+ return ner_model(text)
12
+
13
+ interface = gr.Interface(
14
+ fn=ner_inference,
15
+ inputs=gr.Textbox(lines=5, placeholder="Enter text"),
16
+ outputs=gr.JSON(),
17
+ title="NER using Hugging Face",
18
+ description="Deployed with Gradio on HF Spaces"
19
+ )
20
+
21
+ if __name__ == "__main__":
22
+ interface.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ transformers
2
+ torch
3
+ gradio