nei-demo-backup / app.py
SmitaGautam's picture
Upload 5 files
bb65e7e verified
raw
history blame
928 Bytes
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()