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()