Spaces:
Sleeping
Sleeping
File size: 911 Bytes
880688e |
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 26 27 28 |
import gradio as gr
from svm_predict import predict
def process_sentence(sentence):
words, tags = predict(sentence)
return " ".join([f"<span style='color:green;'>{word}</span>_<span style='color:blue;'>{tag}</span>" for word, tag in zip(words, tags)])
iface = gr.Interface(
fn=process_sentence,
inputs=gr.Textbox(label="Enter a sentence", lines=4),
outputs=gr.HTML(label="NEI tagged sentence", elem_id="output-box"),
css="""
#input-box {
width: 50%;
height: 150px;
}
#output-box {
overflow-y: scroll; /* Always allow vertical scrolling */
padding: 10px;
border-radius: 5px;
box-sizing: border-box; /* Ensures padding is included */
white-space: pre-wrap; /* Ensure the text wraps to avoid horizontal scrolling */
}
""",
live=False
)
iface.launch(share=True) |