|
import streamlit as st |
|
from random import choice |
|
from annotated_text import annotated_text |
|
from resources import * |
|
from helpers import * |
|
|
|
base_model = "xlnet-base-cased" |
|
session = load_variables() |
|
sentences = load_sentences() |
|
baseline_classifier = load_model(f"Dagobert42/{base_model}-biored-finetuned") |
|
augmented_classifier = load_model(f"Dagobert42/{base_model}-biored-augmented") |
|
|
|
st.title("Semantic Frame Augmentation") |
|
st.subheader("Analysing difficult low-resource domains with only a handful of examples") |
|
|
|
st.write("This space uses a xlnet-base-cased model for NER") |
|
augment = st.toggle('Use augmented model for NER', value=False) |
|
|
|
txt = st.text_area( |
|
"Text to analyze", |
|
sentence, |
|
max_chars=500 |
|
) |
|
|
|
if augment: |
|
st.write("with augmentation:") |
|
tokens = augmented_classifier(txt) |
|
else: |
|
st.write("without augmentation:") |
|
tokens = baseline_classifier(txt) |
|
|
|
st.subheader("Entity analysis:") |
|
annotated_text(annotate_sentence(txt, tokens)) |
|
|