|
import gradio as gr |
|
from span_marker import SpanMarkerModel |
|
|
|
|
|
model = SpanMarkerModel.from_pretrained("tomaarsen/span-marker-bert-base-acronyms") |
|
|
|
|
|
def predict_acronyms(text): |
|
if text: |
|
output = model.predict(text) |
|
return output |
|
return {"error": "Please provide valid text"} |
|
|
|
|
|
interface = gr.Interface( |
|
fn=predict_acronyms, |
|
inputs=gr.Textbox(label="Enter some text:", lines=5, placeholder="Type here..."), |
|
outputs=gr.JSON(label="Predicted Output"), |
|
title="Acronym Detection with Span Marker", |
|
description="This application detects acronyms in the given text using the SpanMarker model." |
|
) |
|
|
|
|
|
if __name__ == "__main__": |
|
interface.launch() |