Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
ner_pipeline = pipeline(task='ner', model='cwchang/ner_model', device=-1) | |
def ner(text): | |
output = ner_pipeline(text, aggregation_strategy="simple") | |
return {"text": text, "entities": output} | |
demo = gr.Interface( | |
fn=ner, | |
inputs=gr.Textbox(placeholder="Please enter a sentence here..."), | |
outputs=gr.HighlightedText(), | |
examples=[ | |
["Emily Johnson will attend a United Nations meeting in New York on December 5, 2023."], | |
["Microsoft plans to launch its new tech product in Tokyo at the beginning of 2024."], | |
["Professor Michael Brown from the University of Toronto will present his latest research on climate change."], | |
["The famous Christ the Redeemer statue in Rio de Janeiro, Brazil, is scheduled for renovation in July 2023."], | |
["Maria Fernandez will open a new art gallery in Paris in June 2023."], | |
["The 2023 World Economic Forum is set to take place in Davos, Switzerland, expected to attract numerous international leaders."], | |
["Japanese scientist Ichiro Tanaka discovered a new renewable energy technology at the University of Tokyo."], | |
["The International Red Cross will initiate a humanitarian aid project in Nairobi, Kenya, in May 2023."], | |
["The Sydney Opera House in Australia will host a special concert during Christmas 2023."], | |
["The history museum in Berlin, Germany, will organize a World War II exhibition in January 2024."], | |
["千娜將於2023年8月參加在台北舉行的國際貿易會議。"], | |
["華為公司計劃於2024年在上海推出其最新的智慧型手機。"], | |
["褚志崧教授,來自清華大學,將在國際物理學會議上發表其關於量子計算的研究成果。"], | |
["成都的熊貓基地將於2023年春季對外開放新的參觀區。"], | |
["著名歌手王菲將於2023年10月在香港舉辦個人音樂會。"], | |
["2023年亞洲發展銀行年會計劃在新加坡召開,預計將有多位亞洲國家的領導人出席。"], | |
["日本動畫公司吉卜力將在2024年春季在臺北舉辦動畫展覽。"], | |
["聯合國教科文組織計劃於2023年在曼谷舉辦一次關於教育發展的國際研討會。"], | |
["雪梨歌劇院計劃於2023年聖誕節期間舉辦一場特別的交響音樂會。"], | |
["2024年,韓國首爾將舉辦世界環境保護論壇。"],] | |
) | |
demo.launch(debug=True) |