Spaces:
Runtime error
Runtime error
File size: 550 Bytes
601f74f bcd3c3e 601f74f ac76be2 d4e4acc ac76be2 d4e4acc ac76be2 ac8ec3a ee14c57 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import gradio as gr
from transformers import pipeline
def process_swedish_text(text):
# Models from https://huggingface.co/models
# https://huggingface.co/KBLab/bert-base-swedish-cased-ner
ml_model = 'KBLab/bert-base-swedish-cased-ner'
ner_pipeline = pipeline(model=ml_model, task='ner')
# Run NER
pipeline_results = ner_pipeline(text)
print('NER results:', pipeline_results)
# Return values
return pipeline_results
gradio_interface = gr.Interface(fn=process_swedish_text, inputs="text", outputs="json")
gradio_interface.launch()
|