apak commited on
Commit
54b5a8a
1 Parent(s): 606163a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -29
app.py CHANGED
@@ -1,30 +1,31 @@
1
- # -*- coding: utf-8 -*-
2
- """
3
- Created on Thu Aug 8 15:10:36 2024
4
-
5
- @author: Ali PAK
6
- """
7
- from transformers import pipeline
8
- import gradio as gr
9
- import torch
10
-
11
-
12
- ner_pipeline=pipeline("ner",model="apak/bert-base-uncased-for-ner")
13
-
14
- def ner(text):
15
- output=ner_pipeline(text,aggregation_strategy="simple")
16
- return {"text":text, "entities": output}
17
-
18
- examples=[
19
- " My name is Jessica, I work at Google",
20
- " Arsenal won the FA Cup.",
21
- " Rashid played for Galatasaray Istanbul."
22
- ]
23
- demo=gr.Interface(
24
- ner,
25
- gr.Textbox(placeholder="Enter sentence here..."),
26
- gr.HighlightedText(),
27
- examples=examples
28
- )
29
-
 
30
  demo.launch(share=True)
 
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Created on Thu Aug 8 15:10:36 2024
4
+
5
+ @author: Ali PAK
6
+ """
7
+ !pip install numpy
8
+ from transformers import pipeline
9
+ import gradio as gr
10
+ import torch
11
+
12
+
13
+ ner_pipeline=pipeline("ner",model="apak/bert-base-uncased-for-ner")
14
+
15
+ def ner(text):
16
+ output=ner_pipeline(text,aggregation_strategy="simple")
17
+ return {"text":text, "entities": output}
18
+
19
+ examples=[
20
+ " My name is Jessica, I work at Google",
21
+ " Arsenal won the FA Cup.",
22
+ " Rashid played for Galatasaray Istanbul."
23
+ ]
24
+ demo=gr.Interface(
25
+ ner,
26
+ gr.Textbox(placeholder="Enter sentence here..."),
27
+ gr.HighlightedText(),
28
+ examples=examples
29
+ )
30
+
31
  demo.launch(share=True)