File size: 522 Bytes
71c5e75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
from transformers import pipeline
from span_marker import SpanMarkerModel


def function(messages):
    # Download from the 🤗 Hub
    model = SpanMarkerModel.from_pretrained("tomaarsen/span-marker-bert-base-acronyms")
    # Run inference
    # text = st.text_area('enter some text:')
    
    if text:
        out = model.predict(messages)
    
         return st.json(out)


demo = gr.ChatInterface(fn=function, type="messages", examples=["hello", "hola", "merhaba"], title="Abbreviation-Detector")