Spaces:
Build error
Build error
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,24 +0,0 @@
|
|
| 1 |
-
from transformers import pipeline
|
| 2 |
-
import gradio as gr
|
| 3 |
-
import torch
|
| 4 |
-
import numpy as np
|
| 5 |
-
|
| 6 |
-
device=torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 7 |
-
ner_pipeline=pipeline("ner",model="apak/bert-base-uncased-for-ner")
|
| 8 |
-
def ner(text):
|
| 9 |
-
output=ner_pipeline(text,aggregation_strategy="simple")
|
| 10 |
-
return {"text":text, "entities": output}
|
| 11 |
-
|
| 12 |
-
examples=[
|
| 13 |
-
" My name is Jessica, I work at Google",
|
| 14 |
-
" Arsenal won the FA Cup.",
|
| 15 |
-
" Rashid played for Galatasaray Istanbul."
|
| 16 |
-
]
|
| 17 |
-
demo=gr.Interface(
|
| 18 |
-
ner,
|
| 19 |
-
gr.Textbox(placeholder="Enter sentence here..."),
|
| 20 |
-
gr.HighlightedText(),
|
| 21 |
-
examples=examples
|
| 22 |
-
)
|
| 23 |
-
|
| 24 |
-
demo.launch(share=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|