Spaces:
Sleeping
Sleeping
File size: 817 Bytes
71c5e75 5bf24c4 9d67ccc 5bf24c4 71c5e75 5bf24c4 45f1ced 71c5e75 5bf24c4 45f1ced 5bf24c4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import gradio as gr
from span_marker import SpanMarkerModel
# Download the model from the Hugging Face Hub
model = SpanMarkerModel.from_pretrained("tomaarsen/span-marker-bert-base-acronyms")
# Define the function for prediction
def predict_acronyms(text):
if text:
output = model.predict(text)
return output
return {"error": "Please provide valid text"}
# Create the Gradio interface
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."
)
# Launch the Gradio app
if __name__ == "__main__":
interface.launch() |