File size: 1,688 Bytes
cbf1a0e
ba9e424
cbf1a0e
599afaf
 
cbf1a0e
 
 
246ed34
e1e950a
 
 
 
 
 
 
 
 
 
8534b20
e753dba
8534b20
cbf1a0e
 
8534b20
e1e950a
 
 
cbf1a0e
 
 
 
 
 
 
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
35
36
import spacy_streamlit
import streamlit as st
import typer
from scripts.torch_ner_model import build_torch_ner_model
from scripts.torch_ner_pipe import make_torch_entity_recognizer


def main(models: str = None, default_text: str = None):
    st.title('NER Predictor')
    #st.header('Enter the characteristics of the diamond:')
    #carat = st.number_input('Carat Weight:', min_value=0.1, max_value=10.0, value=1.0)
    #cut = st.selectbox('Cut Rating:', ['Fair', 'Good', 'Very Good', 'Premium', 'Ideal'])
    #color = st.selectbox('Color Rating:', ['J', 'I', 'H', 'G', 'F', 'E', 'D'])
    #clarity = st.selectbox('Clarity Rating:', ['I1', 'SI2', 'SI1', 'VS2', 'VS1', 'VVS2', 'VVS1', 'IF'])
    #depth = st.number_input('Diamond Depth Percentage:', min_value=0.1, max_value=100.0, value=1.0)
    #table = st.number_input('Diamond Table Percentage:', min_value=0.1, max_value=100.0, value=1.0)
    #x = st.number_input('Diamond Length (X) in mm:', min_value=0.1, max_value=100.0, value=1.0)
    #y = st.number_input('Diamond Width (Y) in mm:', min_value=0.1, max_value=100.0, value=1.0)
    #z = st.number_input('Diamond Height (Z) in mm:', min_value=0.1, max_value=100.0, value=1.0)
    
    models = "training/model-best"
    default_text = "The patient had surgery."
    models = [name.strip() for name in models.split(",")]
    labels = ["person", "problem", "pronoun", "test", "treatment"]

    #if st.button('Predict Price'):
    #    st.success(f'The predicted price of the diamond is USD')
    spacy_streamlit.visualize(models, default_text, visualizers=["ner"], ner_labels=labels)


if __name__ == "__main__":
    try:
        typer.run(main)
    except SystemExit:
        pass