File size: 971 Bytes
372cb74
 
00a6def
ec77f50
00a6def
372cb74
ec77f50
 
 
 
 
372cb74
 
00a6def
372cb74
a5515f4
125cf0c
372cb74
 
 
 
 
 
 
00a6def
 
 
 
 
 
 
372cb74
4330a70
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
29
30
31
32
33
34
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))