File size: 826 Bytes
372cb74
 
 
00a6def
 
372cb74
 
 
125cf0c
372cb74
 
00a6def
372cb74
00a6def
125cf0c
372cb74
 
 
 
 
 
 
00a6def
 
 
 
 
 
 
372cb74
00a6def
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
import torch
import streamlit as st
from random import choice
from annotated_text import annotated_text
from helpers import *

with open("sentences.pt", 'rb') as f:
    sentences = torch.load(f)
sentence = choice(sentences)

st.title("Semantic Frame Augmentation")
st.subheader("Analysing difficult low-resource domains with only a handful of examples")

st.write("This space uses a google/mobilebert-uncased 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(sentence, tokens))