Spaces:
Build error
Build error
Download app.py from apak/Multilingual_NER: direct link, hf CLI and curl.
- Browser
- Download file 767 Bytes
-
https://huggingface.co/spaces/apak/Multilingual_NER/resolve/main/app.py
- Command line
-
hf download hf://spaces/apak/Multilingual_NER/app.py
-
curl -L -o app.py https://huggingface.co/spaces/apak/Multilingual_NER/resolve/main/app.py
767 Bytes
| # -*- coding: utf-8 -*- | |
| """ner_proje_deploy.ipynb | |
| Automatically generated by Colab. | |
| Original file is located at | |
| https://colab.research.google.com/drive/1fJxowj49riArEHCkqv3TkCJNN6_kNq5o | |
| """ | |
| from transformers import pipeline | |
| ner_pipeline=pipeline("ner",model="apak/multilingual-xlm-roberta-for-ner") | |
| def ner(text): | |
| output=ner_pipeline(text,aggregation_strategy="simple") | |
| return {"text":text, "entities": output} | |
| import gradio as gr | |
| examples=[ | |
| " My name is Jessica, I work at Google", | |
| " Ayşe ve Hasan Rusya'ya gittiler", | |
| "Flüge vom Flughafen JFK nach Deutschland wurden gestrichen." | |
| ] | |
| demo=gr.Interface( | |
| ner, | |
| gr.Textbox(placeholder="Enter sentence here..."), | |
| gr.HighlightedText(), | |
| examples=examples | |
| ) | |
| demo.launch(share=True) |